Heaps
# Heaps
A specialized tree based data structure.
Efficient data structure to implement a priority queue.
# Implementations
Binary Heap built with a Binary Tree:
# Operations
# Fix Heap (maximising)
Method to obtain retain the heap structure after the root is removed. Assumes both left and right subtrees are already maximising heaps.
|
|
# Example
If there are 2 child nodes, this operation will take 2 comparisons:
# Heapify
Method to obtain the maximising heap property from an arbitrary tree.
Fix the heap from the bottom up:
# Complexity for heap construction: