Operations:
add O(logn), find largest O(1), remove largest O(log(n))
Application:
scheduling long streams of actions to occur at various future times.
useful for sorting.
Common implementation is Heap.
Heap:
max-heap is a binary tree that:
Both labels in both children of each node are less than node's label
So node at the top has largest label.
No comments:
Post a Comment