In a (max) heap it is easy to find the biggest item in O(1)
time, but to actually remove it you need complexity of O(log(n))
.
So if the insertion and deletion from a heap is both O(log(n))
, what are the advantages of a heap over binary tree for representing a priority queue?