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
Which heap is useful for retaining the largest k values from a stream?
Answer & explanation
Answer: A min-heap of at most k retained values
The smallest retained candidate is quickly removed when a larger candidate arrives.