Max-Heap (Size K)
⚙️ Settings
📊 Stream
Numbers will appear...
🔬 K Smallest
—
💡 Algorithm
Maintain MAX-heap of size K.
If new num < heap max:
• Remove max (too large)
• Insert new num
Heap contains K smallest!
If new num < heap max:
• Remove max (too large)
• Insert new num
Heap contains K smallest!