What is the time complexity for decreasing priority of key in a maximum ternary heap of n elements?

Đức Linh

New member
What is the time complexity for decreasing priority of key in a maximum ternary heap of n elements?
A. O (log n/ log 3)
B. O (3log n/ log 3)
C. O (n)
D. O (1)
 
Answer: b
Explanation: In order to decrease the priority of key in a maximum ternary heap data structure having n elements, it performs downward swapping. So the time complexity for worst case is found to be O (3log n/ log 3).
 

Tìm kiếm

Back
Top