Vous êtes sur la page 1sur 4

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.

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.

5.

Write a C program to implement the various operation of Singly linked list. Perform 100 the operation of creating a Linked list, which represent a function create(), Insert the values at the beginning of the list, in the middle of the list and at the end of the list. Delete the elements from list, check for the condition whether the list is empty or not, based on that, perform the operation and display the message. Display the contents of the list. Test your program with 6 elements and provide the output.

6.

Write a C program to implement the operations of the Doubly linked list. Perform the 100 operation of creating a doubly linked list using prev and next pointer, which represent a function create(). Insert the values at the beginning of the doubly linked list, in the middle of the doubly linked list and end of the list. Delete the elements from doubly linked list, check for the condition whether the doubly linked list is empty or not, based on that, perform the operation and display the message. Display the contents of the doubly linked list. Test your program with 6 elements and provide the output.

7.

Write a C program to implement the operations of the singly circular linked list. 100 Perform the operation of creating a circular linked list using next pointer, which represent a function create(). Insert the values at the beginning of the circular linked list, in the middle of the circular linked list and end of the list. Delete the elements from circular linked list, check for the condition whether the linked list is empty or not based on that, perform the operation and display the message. Display the contents of the circular linked list. Test your program with 5 elements and provide the output.

8.

Write a C program to add two polynomials using linked list implementation. Make 100 sure that the output polynomial is sorted by exponent and has at most one term of any power.

9.

Write a C program to convert an infix expression which includes (, ), +, -, * 100 and / to postfix expression.

10. 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,D) : inserte item X on the front end of the dequeue D.

is a data 100

Pop(D) : remove the front item from the dequeue D and display the result.

11. Write a C program to construct an expression tree for the expression ((a+b*c)+(d*e/f)- 100 g). Produce its pre-order, in-order and post-order traversal. 12. Write a C program to construct a binary tree to perform the operation to create a binary 100 tree, write the routine for insert operation which represent a function insert(X,T) and Count the number of nodes in the binary tree. Test your program with at least 5 elements and provide the output. 13. Write a C program to implement binary search tree to insert the elements 100 {3,1,4,6,9,2,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, node with one child and node with two children. 14. Write a C program to Implement binary search tree to creating a Binary Search Tree 100 and Inserting the values {6,2,8,1,4,3,7} into BST. Write the function Find operation, Find Min Operation and Find Max operation. Test your program with above 7 elements and provide the output. 15. Write a C program to inserting the elements {2,1,4,5,9,3,6,7} to its AVL tree and to 100 check whether the tree is balanced or not. If not a balanced tree, apply either single or double rotation to balance the tree. Display the output. 16. Write a C program to implement priority Queue using heaps to perform the following 100 operations. i) ii) Insert operation DeleteMin operation

17. Write a C program to Implement open addressing hash table using linear probing(F), 100 show the result of inserting the keys{89,18,49,58,69,} into a hash table 18. Write a C program to Implement Prims algorithm using priority Queue to find 100 minimum spanning tree of an undirected graph.
A

2 3
D

1
C

3
E

4
F

5G

19. Write a C program to Implement Kruskals algorithm using priority Queue to find 100 minimum spanning tree of undirected graph.
A

2 3
D

1 1.
C F

3
E G

20

Write a C program to Implement dijkstras algorithm to find the shortest weighted 100 path from source to every other vertex in Graph (G).

Vous aimerez peut-être aussi