Question
In Java, which comparison about Top-K with a Heap is accurate?
- There is no practical difference in behavior, performance, or API design when Top-K with a Heap is involved.
- The oldest option related to Top-K with a Heap is always the right production choice regardless of context.
- Differences around Top-K with a Heap are mostly cosmetic, so correctness and maintainability do not change.
- Top-k with a heap is more space-aware than sorting the full input when only a small subset is needed.
Hint
Focus on the behavior or tradeoff, not just the keyword.
Answer and rationale
Correct answer: D. Top-k with a heap is more space-aware than sorting the full input when only a small subset is needed.
Top-k with a heap is more space-aware than sorting the full input when only a small subset is needed. This is the comparison that usually separates memorization from understanding.
Track: Java