DSAverse
Heap-like Data Structures
Loading Heap Structures...
Max Heap
root: 90Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Heap-like Data Structures
Loading Heap Structures...
Max Heap
root: 90Explore priority queue implementations — from classic binary heaps to advanced mergeable structures. Visualize insert, extract, and merge operations step by step.
Complete binary tree with heap property — parent is always ≥ (max-heap) or ≤ (min-heap) its children. Array-based implementation with O(1) peek.
Forest of binomial trees with unique ranks. Merging works like binary addition — two trees of the same rank merge into one of the next rank.
Lazy heap where insert adds a singleton tree to the root list. Consolidation is deferred until extract-min, giving O(1) amortized insert and decrease-key.
Binary heap where npl(left) ≥ npl(right) at every node. The right spine is kept short (O(log n)), and all operations reduce to a single merge primitive.
Self-adjusting version of the leftist heap. No npl stored — children are unconditionally swapped on every merge step, achieving amortized O(log n) without bookkeeping.
Heap-like structures power priority-based operations and are fundamental to graph algorithms, OS scheduling, and real-time systems.
Parent-child ordering guarantees O(1) min/max access
Combining two heaps efficiently — the distinguishing feature
Average cost over a sequence of operations, not worst case alone
| Structure | Insert | Extract Min | Merge | Best Use Case |
|---|---|---|---|---|
| Binary Heap | O(log n) | O(log n) | O(n) | Simple priority queues |
| Binomial Queue | O(1)* | O(log n) | O(log n) | Frequent merging |
| Fibonacci Heap | O(1) | O(log n)* | O(1) | Graph algorithms |
| Leftist Heap | O(log n) | O(log n) | O(log n) | Persistent structures |
| Skew Heap | O(log n)* | O(log n)* | O(log n)* | Simple implementation |
* Amortized time complexity