Data Structures (IT205)


1. Write code for creating a linked list, adding elements to the linked list
at the tail, searching for an element with a particular key and also
deleting an element with a particular key if it exists.
2. Write a code for implementing a stack, a queue, and a queue simulated
by two stacks and a stack simulated by two queues, all using prespec-
ified size arrays. You need to implement the push, pop, enqueue,
dequeue operations and error checks.
3. Implement stacks and queues using the linked list data-structure.
4. Write code for reversing a singly linked list.
5. (a) Implement routines for exchanging two elements of a stack. You
may use two extra stacks for temporary storage.
(b) Implement a routine for reversing a contiguous subsequence of a
stack of elements. Again you may use two auxilliary stacks for
temporary storage.
(c) Write a routine for exchanging two elements of a queue using two
extra queues for temporary storage.
(d) Write routine for reversing a subsequence of contiguous elements
of a queue, using two auxilliary queues.
Powered by