🎴 Flashcard Mode

Test 1 Algorithms | Computer Science

Card1 / 20
Mastered0
Review0
QuestionClick to flip

In a heap with n elements with the smallest element at the root, the 7th smallest element can be found in time

AnswerClick to flip back
A
O(log n)
💡 Explanation:

Here we can follow simple procedure, we can rum heap sort for 7 iterations. In each iteration the top most
element is smallest, we note & then replace it with the last element, then we run min heapify algorithm,
which brings next smallest element on top. This procedure
take 0 (log n) time.
We need to run it for 7 times. So tight bound O(7 log n) = O(log n)

Change Mode