edited by
601 views
5 votes
5 votes

Which of the following statements is/are TRUE? (Mark all the appropriate choices)

  1. The worst case runtime for searching in a binary tree can be $\Omega (n).$
  2. The minimum number of comparisons to sort $5$ elements is $4.$
  3. There can be at most $\left \lfloor \dfrac{n}{2^{h-1}} \right  \rfloor $ nodes of height $h$ ($h$ starting from $1$) in any $n$ element heap.
  4. The time to find the maximal element in a min-heap of $2^n-1$ elements is $\Omega(2^n).$
edited by

1 Answer

Best answer
6 votes
6 votes

A is TRUE. Happens for a left-skewed or right-skewed binary tree.
 
 B is FALSE. Minimum number of comparisons to sort $5$ elements is $7$ as proved by  Demuth in his Ph.D. thesis. https://cs.stackexchange.com/questions/44981/least-number-of-comparisons-needed-to-sort-order-5-elements
 
 C is FALSE. There can be at most $\left \lceil \dfrac{n}{2^{h-1}} \right \rceil $ nodes of height $h$ in any $n$ element heap when $h$ starts from $1$ and this changes to $\left \lceil \dfrac{n}{2^{h+1}} \right \rceil $ when $h$ starts from $0$. Ref: https://www2.cs.sfu.ca/CourseCentral/307/petra/2009/SLN_2.pdf
 
 D is TRUE as maximum element in a min-heap will be at the last level and it can be any one of the possible $n/2$ elements in the last level.

edited by
Answer:

Related questions