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

Tech Degree Examinations, Oct-Nov-2012 CS 2208-DATA STRUCTURES LAB B.E COMPUTER SCIENCE AND ENGINEERING Time: 3 Hours 1 Maximum Marks: 100

Create a menu for Insert a node, Delete a node, Search for a number, Print the list (100) and Exit. Insert the node into a linked list in such a way that the numbers are in ascending order. While inserting if duplicate is present then ignore insertion. Deleting a node is direct deletion from linked list. For searching option check whether a node is present and for print option just print the values in the nodes in order. Create a doubly linked list and insert a string into the created list where each node (100) is a single character. Check whether the string placed in the doubly linked list is a palindrome. Implement polynomial addition with carry using a linked list. Consider two polynomials as given below: X4+3x2+2 X3+4x2+2x+1 Add these two polynomials using singly linked list. Convert the given infix expression (5*4)+6/2-3+1 into postfix expression by implementing the above using stack. (100) (100)

2

3 4

5

(100)

6

Given the expression (8/2+2*5+(3-2)*4). Write a program to convert the given (100) expression into postfix notation using stack. Implement a queue using a single array. The functions to be implemented are (100) inserting a value into queue and delete a value from the queue. Let the maximum size of the queue be 10. All the cells should be optimally utilized. For example if we perform 9 additions and 3 deletions then the queue should allow 4 more additions. Implement a queue using a circular linked list. (100)

7

8 9

Given an expression write a program to print the three traversal orders of the tree. (100) Construct the tree in the initialisation phase.

24.78. 11 Write a program to construct a binary search tree. (100) (100) (100) 19 Write a program to construct a binary tree from its inorder and post order (100) traversals. MON.50.45.24.90.50. 23.98.13.78. FRI.16. 12 Given two values from a binary tree write a program to find out the first common (100) parent of both the nodes in the binary tree. 16 Write a program to create a hash table for the given set of values using linear (100) probing with replacement in open addressing scheme. 15 Write a program to find the maximum value in a set of values by implementing (100) priority queue using heap. Inorder: 1 2 3 4 5 6 7 8 9 Postorder: 1 3 5 4 2 8 7 9 6 20 Write a program to check whether the contents of two stacks are identical.45.90.13. Construct the tree in the initialisation phase and find (100) whether right and left side of the tree is the mirror image of one another. 14 For the given set of values construct an AVL tree. If there is a collision insert all the colliding values in a linked list attached to that bucket. (100) .56. THU. SAT and SUN.16.98. 18 Write a program to find the minimum spanning tree using Prims algorithm. 17 Write a program to create a hash table for the given set of values using linear (100) probing without replacement in open addressing scheme. TUE.99.56. 23. WED.99. 13 Write a program to construct an AVL tree for values 1 to 10. Write functions for adding a (100) node into the tree and to search for a particular value in the tree.10 Given an expression.