Top K Sort
Extract and sort the top k elements (smallest or largest) from a sequence without fully sorting it.
5 notes
Extract and sort the top k elements (smallest or largest) from a sequence without fully sorting it.
Maintain the k largest elements while values arrive one at a time.
Find the k largest elements using partition-based selection in linear time.
Find the k largest or k smallest elements by maintaining a bounded heap.
Find the largest or smallest k elements without sorting the full input, using a heap or partition-based approach.