edited by
1,961 views
7 votes
7 votes

Match the following and choose the correct answer in the order $A, B,C$

$\begin{array}{|ll|ll|} \hline \text{A.} & \text{Heap Construction} & \text{p.} & O(n\log n) \\\hline \text{B.} & \text{Hash Table construction with linear probing} & \text{q.} & O(n^2)  \\\hline \text{C.} & \text{AVL Tree Construction} & \text{r. }& O(n) \\\hline  \end{array}$

(Bounds given may or may not be asymptotically tight)

  1.  $a-q,b- r, c-p$
  2.  $a-p, b-q, c-r$
  3.  $a-q, b-p, c-r$
  4.  $a-r, b-q, c-p$
edited by

2 Answers

7 votes
7 votes

Build Heap — O(n)


AVL tree construction — O(nlogn).

For a node, we'd take O(logn) time to find it's correct place, and to fix the height if needed. For n such nodes, O(nlogn)


Hash Table with LP — $O(n^2)$

In the worst case for an element, we'd have to traverse the entire list to put the element in an empty slot. So, O(n).

For n such elements,  $O(n^2)$


Option D

Answer:

Related questions

3 votes
3 votes
2 answers
1
gatecse asked Dec 17, 2017
1,248 views
The $in$-$order$ and $pre$-$order$ traversal of a binary tree are $\text{d b e a f c g}$ and $\text{a b d e c f g}$ respectively.The $post$-$order$ traversal of a binary ...
40 votes
40 votes
5 answers
2
Kathleen asked Sep 22, 2014
43,555 views
What is the maximum height of any AVL-tree with $7$ nodes? Assume that the height of a tree with a single node is $0$.$2$$3$$4$$5$
3 votes
3 votes
2 answers
3
gatecse asked Dec 17, 2017
3,739 views
Which one of the following property is correct for a red-black tree?Every simple path from anode to a descendant leaf contains the same number of black nodes.If a node is...
2 votes
2 votes
2 answers
4
gatecse asked Dec 17, 2017
1,263 views
A strictly binary tree with $10$ leavescannot have more than $19$ nodeshas exactly $19$ nodeshas exactly $17$ nodeshas exactly $20$ nodes