Priority Queues

Binary Heap Visualizer

Visualize how a Binary Heap maintains the Max/Min property through insertion and extraction.

📜 Execution Log

Input a value and click Insert.

🏗️ Array Mapping

A Binary Heap is a complete tree stored in an array.
Left Child: 2 * i + 1
Right Child: 2 * i + 2
Parent: floor((i - 1) / 2)

💡 Complexity

  • Insert: O(log n)
  • Delete: O(log n)
  • Get Top: O(1)
  • Build: O(n)