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

Tech Degree Examinations, Oct-Nov-2012 CS2208 – Data Structures Lab Computer Science and Engineering Time: 3 Hours 1 Maximum Marks: 100

Write a function program to perform the following operations on a singly linked (100) list i. Create a list ii. Insert an element to the list iii. Delete the maximum element from the list iv. Arrange the list as sorted order v. Display the elements of the list Write a main method to demonstrate the above functionalities.

2

Write a function program to perform the following operations on a singly linked (100) list i. Create a list ii. Find the smallest element from the list iii. Insert an element if it is not a duplicate element iv. Display the elements in reverse order v. Find the number of odd values and even values Write a main method to demonstrate the above functionalities.

3

Write a function program to perform the following operations on a doubly linked (100) list i. Create a list ii. Insert an element to the list iii. Delete a specific element from the list iv. Display the content of the list v. Find the number of elements in the list Write a main method to demonstrate the above functionalities.

4

Write a function program to perform the following operations on a singly linked (100) list i. Create a list ii. Insert an element in a specific location iii. Delete the last element of the list iv. Display the content of the list v. Find the maximum and minimum element of the list Write a main method to demonstrate the above functionalities.

Insert an element into the queue iii. Write a function program to perform the following operations in double-ended 12 queue 8 i. exponent part. Write another 10 function to form an expression tree for the expression X and evaluate the same. Write a function to read an expression X=A+B*C+(D*E+F)*G. Create a double ended queue ii. ii. exponent part. Let X and Y are two singly linked lists which stores a character of a string. Write (100) a function to perform the following operations Create a list Finds the number of characters in each string Find the first character in the string X which does not occur in string Y iv. Write a function program to get two polynomials as input and also write a function to perform addition operation on two polynomials. Assume that the infix expression X is terminated by a character $. Also write a main method to demonstrate the polynomial subtraction using singly linked list. Assume that the infix expression X is terminated by a character #.5 6 7 Create a structure called Node to store a term of a polynomial which contains the (100) coefficient. i. Create a structure called Node to store a term of a polynomial which contains the (100) coefficient. iii. Also include a main program to demonstrate the expression tree and evaluate it Write a function to read an expression X =(A+B)*D+E/(F+A*D)+C. and a link field to point to another node in the linked list. Concatenate the two string v. and a link field to point to another node in the linked list. Display all the elements of the queue v. Write a main method to demonstrate the above functions. Write an algorithm to transform an infix expression X into its postfix equivalent and also write a function to evaluate the postfix expression. Write a function to read an expression and which is stored in X=A+B*C+(D*E+F)*G as infix format. Find the maximum element from the queue Write a main method to execute the above functions (100) (100) (100) (100) (100) . Write an algorithm to transform an infix expression X into its postfix equivalent and also write a function to evaluate the postfix expression. Write a function to read an expression and which is stored in 9 X=(A+B)*D+E/(F+A*D)+C as infix format. Also write a main method to demonstrate the polynomial addition using singly linked list. Write 11 another function to form an expression tree for the expression X and evaluate the same. Write a function program to get two polynomials as input and write another function to perform addition operation on two polynomials. Display the two string Write a main method to demonstrate the above functions. Write a main method to demonstrate the above functions. Also include a main program to demonstrate the expression tree and evaluate it. Delete an element from the queue iv.

Insert an element to the tree iv. Perform the rotation operation for converting the BST to AVL tree iii. Display the content of the tree iii. Find the minimum element from the queue iv. 8. 5.13 Write a function program to perform the following operations in double-ended (100) queue i. Create a binary search tree with the value of 1. Display all the elements of the queue iii. Perform the rotation operation for converting the BST to AVL tree iii. ii. Find the leftmost element from the tree Write a main method to demonstrate the above functions 15 Write a function program to perform the following operations in binary search (100) tree Create a binary search tree Display the content of the tree Find the largest element from the tree Count the number of even value data from the tree (ie value divided by 2) v. Delete an element from the tree v. 7. 4. Count the number of elements using traverse operation in the AVL tree v. Insert an element which is not existing in the queue v. Write a main method to demonstrate the above functions i. iii. Create a binary search tree ii. 9 ii. 2 ii. Display the content of the AVL tree Write a main method to demonstrate the above functions . Create a binary search tree with the value of 10. Find the smallest element from the tree AVL tree iv. 3. Display the content of the AVL tree Write a main method to demonstrate the above functions (100) 17 Write a function program to perform the following AVL tree operations (100) i. Delete an element from the tree v. Insert an element into the tree iv. Sort the elements in ascending order Write a main method to equip the above functions 14 Write a function program to perform the following operations in binary search (100) tree i. 16 Write a function program to perform the following AVL tree operations i. Create a double ended queue ii. 6. Count the total number of elements in the tree. iv.

18 Write a function program to perform the following AVL tree operations Create a binary search tree with the value of 1. Develop a Minimum Spanning Tree for the graph v. 4. iii. 2. ii. Develop a Minimum Spanning Tree for the graph v. ii. 5 Perform the rotation operation for converting the BST to AVL tree Find the largest element from the AVL tree Find the sum of all elements in tree using traverse operation in the AVL tree v. 3. (100) 21 Implement Prim’s algorithm with the following functionalities Read a set of vertices minimum of six from the keyboard Get the number of edges and form the graph Find the value of each edge by using distance formula for two points. Delete the minimum element from the heap v. . Display the content of the heap Write a main method to demonstrate the heap operations i. iii. (100) 19 Write a function program to perform the following priority queue operations i. Find the maximum and minimum length of the edges Write a main method to execute the above functionalities i. iv. iii. Find the total length of all edges. Write a main method to execute the above functionalities i. iv. Insert an element into the heap iv. Display the content of the heap Write a main method to demonstrate the heap operations (100) 20 Write a function program to perform the following priority queue operations Create a array of 10 different elements Convert the array elements into binary heap Find the largest element from the heap Find the number of elements from the heap using traverse operation v. iv. ii. 22 Implement Prim’s algorithm with the following functionalities Read a set of vertices minimum of six from the keyboard Get the number of edges and form the graph Find the value of each edge by using distance formula for two points. iii. iv. Display the content of the AVL tree Write a main method to demonstrate the above functions i. Create a array of 10 different elements ii. ii. Convert the array elements into binary heap iii.

Create a hash table of size minimum of 10 ii. delete an element from the hash table v. Display the hash table and its key values Write a main method to execute the above function using open addressing . Apply a hash function (mod) to find the key iii. Create a hash table of size minimum of 10 ii. Search an element from the hash table v. Insert an element in to the hash table iv.23 Write a function program to perform the following operations while implementing hashing technique i. Insert an element in to the hash table iv. Display the hash table and its key values Write a main method to execute the above function using open addressing 24 Write a function program to perform the following operations while implementing hashing technique i. Apply a hash function (mod) to find the key iii.