Question Paper Code:: Reg. No.
Question Paper Code:: Reg. No.
Question Paper Code:: Reg. No.
Reg. No. :
4. Prove that any comparison sort algorithm requires Ω (n log n) comparisons in the
worst case.
11. a) i) Write the Insertion sort algorithm and estimate its running time. (7)
ii) Find the closest asymptotic tight bound by solving the recurrence equation
T(n) = 8T(n/2) + n2 with (T(1)=1) using Recursion tree method. [Assume that
T(1)∈Θ(1)]. (6)
(OR)
b) i) Suppose W satisfies the following recurrence equation and base case (where
c is a constant) : W(n) = c.n + W(n/2) and W(1) = 1. What is the asymptotic
order of W(n) ? (6)
ii) Show how to implement a stack using two queues. Analyze the running time
of the stack operations. (7)
12. a) What is divide and conquer strategy and explain the binary search with suitable
example problem. (13)
(OR)
b) Solve the following using Brute-Force algorithm : (13)
Find whether the given string follows the specified pattern and return 0 or 1
accordingly.
Examples :
i) Pattern : “abba”, input : “redblueredblue” should return 1
ii) Pattern : “aaaa”, input : “asdasdasdasd” should return 1
iii) Pattern : “aabb” input : “xyzabcxzyabc” should return 0.
13. a) Give the Pseudo code for Prim’s algorithm and apply the same to find the
minimum spanning tree of the graph shown below :
(OR)
b) Explain the memory function method for the Knapsack problem and give the
algorithm.
*X20397* -3- X20397
16. a) Apply the greedy technique to find the minimum spaning tree using Prim’s
algorithm for the given graph. (15)
(OR)
b) Explain the 4-Queen’s problem using backtracking. Write the algorithms. Give
the estimated cost for all possible solutions of 4-Queen’s problem. Specify the
implicit and explicit constraints. (15)
–––––––––––––