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

Quang Hiếu

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

Tìm kiếm

Back
Top