03-12-2012, 06:33 PM
DS & A Assignment 2
DS_asst2.doc (Size: 34 KB / Downloads: 44)
1. A. Define Data structure, algorithm and program .
B. Explain the different criteria an algorithm should satisfy.
C. Discuss the Asymptotic notation explaining O, Ω, and Θ with appropriate example.
2. How do you analyze the performance of an algorithm? Explain with examples.
3. Clearly stating the data structures required, write functions to add an element into double list and delete element from single list.
4. A. Clearly stating the required data structure, write a recursive function to create Binary Tree.
B. Write a non-recursive preorder traversal function for Binary Tree.
5. Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.
6. A. Write the algorithm for Quick sort and trace the algorithm using a set of 5 numbers as input.
B. Derive the worst case and average case time complexity for Quick sort.
7. Consider two linked list A and B in sorted order. Write a program to merge the linked list A and B such that the final list C is in sorted order.
8. How linear queue differs from circular queue? Write functions to insert and delete elements from circular queue