Question
Which statement about Top-K with a Heap is the strongest interview answer?
- Top-K with a Heap is mostly a naming style choice and has little effect on runtime or design.
- Top-K with a Heap exists mainly to reduce the number of Java files in a project.
- A bounded heap can keep only the k best candidates seen so far instead of storing all values.
- Top-K with a Heap matters only for frontend frameworks, not for core Java applications.
Hint
Start with the core rule behind Top-K with a Heap.
Answer and rationale
Correct answer: C. A bounded heap can keep only the k best candidates seen so far instead of storing all values.
A bounded heap can keep only the k best candidates seen so far instead of storing all values. This is the base concept interviewers commonly test first.
Track: Java