Binary Heaps, Priority Queues & Top-K
Pointerless complete binary tree in a flat array (`(i-1)//2`, `2i+1`, `2i+2`), O(n) heapify, and O(n log k) Top-K.
Related problems 7
-
Kth Largest Element in a Stream
-
Network Delay Time
-
Top K Frequent Elements
-
K Closest Points to Origin
-
Swim in Rising Water
-
Merge k Sorted Lists
-
Find Median from Data Stream