CS2208 2 Set3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

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)

3 4

(100)

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)

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.

10 Given an expression. 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. 11 Write a program to construct a binary search tree. Write functions for adding a (100) node into the tree and to search for a particular value in the tree. 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. 13 Write a program to construct an AVL tree for values 1 to 10. 14 For the given set of values construct an AVL tree. MON, TUE, WED, THU, FRI, SAT and SUN. 15 Write a program to find the maximum value in a set of values by implementing (100) priority queue using heap. 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. 23,45,16,78,90,13,24,56,98,50,99. 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. If there is a collision insert all the colliding values in a linked list attached to that bucket. 23,45,16,78,90,13,24,56,98,50,99. 18 Write a program to find the minimum spanning tree using Prims algorithm. (100) (100) (100)

19 Write a program to construct a binary tree from its inorder and post order (100) traversals. 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. (100)

You might also like