PRACTICE / UNDERSTAND / REPEAT

Data Structures & Algorithms practice question

Practice heaps with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

1 questionAnswers explainedFree · no login

Try this question

Heaps · MCQQuestion link ↗

Which heap is useful for retaining the largest k values from a stream?

Choose one answer
Answer & explanation

Answer: A min-heap of at most k retained values

The smallest retained candidate is quickly removed when a larger candidate arrives.