Note : Question number 1 is compulsory. Attempt any three questions from the rest. All algorithms should be written nearer to 'C' language.
Q.1. (a) Write an algorithm for the addition of two polynomials in one variable.
(b) Define a stack. Explain the operations that can be performed on a stack. How are multiple stack implemented using arrays ?
(c) Define and give an example of a Minimum Cost Spanning Tree. Write at least two differences between Kruskal's and Prim's Algorithms.
(d) Define a heap. Sort the following numbers using Heap Sort :
2, 3, 81, 64, 4, 25, 36, 16, 9, 49
Clearly write all the steps involved in sorting the numbers.
Q.2. (a) Give simplified big-O notation for the following functions
:
(i) 30 n2
(ii) log n+3n
(b) Define dequeue. Wnte an algorithm for the implementation of a dequeue using arrays.
Q.3. (a) Define a tree, and a binary tree. What are the different ways of traversing a binary tree ? Write an algorithm for any one of the traversal methods.
(b) Write an algorithm for the implementation of Binary Search. What are its Space and Time complexities ?
Q.4. (a) Define an AVL tree. In case an AVL tree becomes unbalanced, how will you balance it ? Explain with example(s).
(b) Explain an indexed Sequential File Organisation.