ANNA UNIVERSITY : CHENNAI – 600 025 B.E/B.

Tech Degree Examinations, Oct-Nov-2012 CS2208 Data Structures Lab (B.E COMPUTER SCIENCE AND ENGINEERING) Regulations - 2008 Time: 3 Hours 1. Maximum Marks: 100

Write a C program to implement a Stack ADT using array and write the routine for 100 push operation which represent a function PUSH(X, S), Check for the condition whether S-full or not, if yes display the message otherwise insert the elements into the Stack. Perform POP operation which represents a function POP(S), Check for the condition whether S-Empty, if stack is empty, display the message otherwise delete an element from the Stack. Test your program with at least 5 elements and provide the output. Write a C program to implement a stack ADT using Linked List and write the routine 100 to create a empty stack and perform the operation of push(X,S) by inserting an element at the front of the list, POP(S) operation is performed by deleting the element at the front of the list and display the elements from Linked list. Test your program with at least 6 elements and provide the output. Write a C program to implement the Queue ADT using array and write the routine to 100 enqueue an element X into queue, Check for the conditions Q-full, if yes display the message otherwise insert the data into the queue and dequeue an element from queue, check for the conditions Q-empty, if yes display the message otherwise deleting the element from the queue and display the elements from the Queue ADT. Test your program with at least 6 elements and provide the output

2.

3

4.

Write a C program to implement a Queue ADT using Linked List to create a Queue, 100 write the routine for enqueue operation which represents a function enqueue(X) performed at the end of the list, dequeue operation which represents a function dequeue(Q) performed at the front of the list. Test your program with at least 5 elements and provide the output.

100 Perform the operation of creating a circular linked list using next pointer. Write a C program to implement the double ended Queue (Dequeue) structure consisting of list of items to perform the following operations i) ii) Push(X. Display the contents of the list. in the middle of the circular linked list and end of the list. 6. Display the contents of the circular linked list. 7. 9. Write a C program to add two polynomials using linked list implementation. Write a C program to convert an infix expression which includes ‘(‘. which represent a function create(). ’*’ 100 and ‘/’ to postfix expression. Delete the elements from list. Perform the 100 operation of creating a doubly linked list using prev and next pointer. Test your program with 6 elements and provide the output. check for the condition whether the linked list is empty or not based on that. which represent a function create(). 10.5. Make 100 sure that the output polynomial is sorted by exponent and has at most one term of any power. Insert the values at the beginning of the doubly linked list. Write a C program to implement the various operation of Singly linked list. Delete the elements from circular linked list. Test your program with 6 elements and provide the output. Write a C program to implement the operations of the Doubly linked list. is a data 100 Pop(D) : remove the front item from the dequeue D and display the result. in the middle of the doubly linked list and end of the list. perform the operation and display the message. Test your program with 5 elements and provide the output. ’)’. in the middle of the list and at the end of the list. perform the operation and display the message. . ’-‘. ’+’. check for the condition whether the list is empty or not. based on that. Perform 100 the operation of creating a Linked list. Write a C program to implement the operations of the singly circular linked list. Insert the values at the beginning of the list. Insert the values at the beginning of the circular linked list. Display the contents of the doubly linked list. Delete the elements from doubly linked list. perform the operation and display the message.D) : inserte item X on the front end of the dequeue D. check for the condition whether the doubly linked list is empty or not. based on that. which represent a function create(). 8.

4. Write the function Find operation.T) and Count the number of nodes in the binary tree. Test your program with at least 5 elements and provide the output. Write a C program to implement binary search tree to insert the elements 100 {3.1. Write a C program to construct an expression tree for the expression ((a+b*c)+(d*e/f).18. 16.7} into BST. 14.69.100 g). Write a C program to Implement binary search tree to creating a Binary Search Tree 100 and Inserting the values {6.4.11.49. Write a C program to implement priority Queue using heaps to perform the following 100 operations. i) ii) Insert operation DeleteMin operation 17.2.9. 100 show the result of inserting the keys{89.5.7} and write the routine for delete operation which represent the function delete(X) and show the result of node to be deleted is a leaf node. Write a C program to inserting the elements {2.58. apply either single or double rotation to balance the tree. A 2 3 D B 1 C 3 E 4 4 F 2 1 5G . Display the output.1. 13.3. Find Min Operation and Find Max operation.1. If not a balanced tree. write the routine for insert operation which represent a function insert(X. Write a C program to Implement Prim’s algorithm using priority Queue to find 100 minimum spanning tree of an undirected graph.8.6. Produce its pre-order. Write a C program to construct a binary tree to perform the operation to create a binary 100 tree. Test your program with above 7 elements and provide the output. Write a C program to Implement open addressing hash table using linear probing(F). 12.7} to its AVL tree and to 100 check whether the tree is balanced or not.9. node with one child and node with two children.4.} into a hash table 18.6.2. 15. in-order and post-order traversal.5.3.

19. . Write a C program to Implement Kruskal’s algorithm using priority Queue to find 100 minimum spanning tree of undirected graph. A 2 3 D B 1 1. C F 3 E G 2 1 4 5 20 Write a C program to Implement dijkstra’s algorithm to find the shortest weighted 100 path from source to every other vertex in Graph (G).