⚡ Priority Queues

Binary Heap Monster

Max or Min Heap — insert, extract, and watch the heap property be maintained with live array + tree views.

📦
7
Heap Size
👑
50
Root Value
📐
3
Tree Height
🔄
0
Total Swaps
MAX HEAP
Array Representation (Index 0 = Root)
Heap empty

Operation Log

Insert a value and watch the heap property be maintained!
Challenge Mode 0
Predict the root after operations! Tests your heap property mastery.
❤️❤️❤️

🏗️ Heap Properties

Max Heap: Parent ≥ both children
Min Heap: Parent ≤ both children
Left Child: 2i + 1
Right Child: 2i + 2
Parent: ⌊(i-1)/2⌋

⚡ Time Complexity

Insert O(log n)
Extract Root O(log n)
Peek Root O(1)
Build Heap O(n)
Heap Sort O(n log n)