Week 3 · Day 19 of 42

Heap / Priority Queue: Top K Elements

To find the K largest: use a min-heap of size K. Push every element, pop when size > K.

Checking access

Spotted a mistake on this page?

Wrong formula, broken animation or confusing wording. Tell us and we will fix it.