In a binary min-heap containing 'n' numbers, the largest can be found in…
2022
In a binary min-heap containing 'n' numbers, the largest can be found in ______ time.
- A.
θ(n)
- B.
θ(log n)
- C.
θ(log log n)
- D.
θ(1)
Attempted by 1024 students.
Show answer & explanation
Correct answer: A
In a min-heap , the minimum is at the root, but the maximum can be anywhere in the heap. Therefore, we must scan all n elements → θ(n) time