Glossary: System Design Beyond the Basics
heapq.nlargest
Also written: heapq
A function from Python's `heapq` module that returns only the k items with the largest key, biggest first, without sorting everything.
Glossary: System Design Beyond the Basics
Also written: heapq
A function from Python's `heapq` module that returns only the k items with the largest key, biggest first, without sorting everything.