Top-K with a heap is a pattern Amazon uses for nearest-warehouse routing and "closest delivery hub" features.
Enable JavaScript for the full StreamPrep guide.