I) Part A Is Compulsory Question For 20 Marks
I) Part A Is Compulsory Question For 20 Marks
COM
Instructions:
i) Part A is compulsory Question for 20 marks.
ii) Part B consists of five questions with “either” “or” pattern. The student has to answer any one.
However students have to answer five questions from Part B (numbered from 2 to 6)
PART - A
(Answer all sub questions)
5 × 4 marks = 20
1.a) Define the terms “Time complexity” and “Space complexity” of algorithms. Give a
notation for expressing such a complexity and explain the features of such a notation.
b) Imagine we have two empty stacks of integers, s1 and s2. Draw a picture of each
stack after the following operations.
pushStack(s1,3);
pushStack(s1,5);
pushStack(s1,7);
pushStack(s1,9);
while (!
emptyStack(s1)){ p
opStack(s1,x);
popStack(s1,x);
pushStack(s2,x); }
c) Express, in recursive equation form, the time required to search an element from an
array of n elements using binary search method.
d) List and explain the usage of different binary tree traversals.
e) Write briefly about compressed tries.
PART - B
5 × 8 marks = 40
Answer either “a” or “b” from each question
3.a) Define Max-heap. Write Max-Heapify algorithm that maintain max-heap property.
OR
b) Write a java program to implement Dequeue ADT.
4.a) Apply Quick sort algorithm for the following array of elements and sort the
elements
(Take the element 28 from the list as the pivot element). Also discuss the
complexity of the algorithm for worst case and best case. 28, 32, 12, 5, 48, 13, 35,
11
OR
b) Explain clearly the collision resolution methods applied in hashing.
6.a) Illustrate with an example the usage of TreeSet and TreeMap classes.
OR
b) Explain Huffman coding and decoding.
****************