UGC-NET Dec 2014 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0012

Match the following $:$ $\begin{array}{}  & \textbf{List – I} &  & \textbf{List – II} \\ \text{a.} & \text{Bucket sort} & \text{i.} & O(n^3\lg n)  \\ \text{b.} & \text{Matrix chain multiplication} & \text{ii.} & O(n^3) \\  \text{c.} & \text{Huffman codes} & \text{iii.} & O(n\lg n) \\ \text{d.} & \text{All pairs shortest paths} & \text{iv.} & O(n) \\  \end{array}$ $\textbf{Codes :}$
  1. A
    $\text{a-iv, b-ii, c-i, d-iii}$
  2. B
    $\text{a-ii, b-iv, c-i, d-iii}$
  3. C
    $\text{a-iv, b-ii, c-iii, d-i}$
  4. D
    $\text{a-iii, b-ii, c-iv, d-i}$

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutiona. Bucket sort on uniformly distributed input runs in \(O(n)\) expected time, so a-iv.b. Matrix-chain multiplication by dynamic programming fills \(O(n^2)\) entries, each in \(O(n)\): \(O(n^3)\), so b-ii.c. Huffman coding with a min-priority queue does \(n-1\) merges of \(O(\lg n)\) each: \(O(n\lg n)\), so c-iii.d. All-pairs shortest paths by repeated squaring of the distance matrix: \(\lg n\) products of \(O(n^3)\) each, \(O(n^3\lg n)\), so d-i.The code a-iv, b-ii, c-iii, d-i is option C.Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com