Professional Documents
Culture Documents
Sample
Sample
1 a. Give the general divide and conquer recurrence relation and explain the same. Mention the use of
master’s theorem in solving recurrence relation with an example.
b. Write the quick sort algorithm. Analyse its efficiency. Apply the algorithm to sort the list
9, 1, 6, 3, 9, 2, 7, 5
the source.
5 a. Write algorithms for Heap sort to sort the elements using bottom up and top-down approach.
b. Apply bottom up and top-down approach for the following data to construct Heap.
30,40,50,60,60,50,40,30,20
6 a Compare Divide and Conquer technique with Greedy Techniques
b. Solve the following instance of Greedy knapsack problem. n=7,
[w1, w2, w3, w4, w5, w6. w7 ]=[1 3 5 4 1 3 2]
[p1,p2,p3,p4,p5,p6,p7]=[10,15,7,8,9,4] and M=15.
b. Construct Huffman tree and decode DAD_CD for the below given input.
Alphabet A B C D E _
Frequencies 0.35 0.15 0.2 0.2 0.25 0.40
10 a. Justify with an example how Insertion sort belongs to Decrease and Conquer
b. Sort the following data using Insertion Sort and show the order of elements after each iteration.
30,40,50,60,60,50,40,30,20