Heaps & Priority Queues

Module 4.6 — Binary heap with bubble-up/down animation

Type:
Preset:

Heap Tree

Insert elements or load a preset

Array Representation

Heap Properties

Size0
Height0
Root (min)
TypeMin-Heap

Time Complexity

InsertO(log n)
ExtractO(log n)
PeekO(1)
HeapifyO(n)

Activity Log

Heap initialized. Add elements or load a preset.

How Binary Heaps Work

Insert: Add at end, bubble up by swapping with parent if heap property violated.
Extract: Remove root, move last to root, bubble down by swapping with smaller (min) / larger (max) child.
Property: Every parent ≤ both children.