Time O(N log k). Space O(logk).
Tag Archives: heap
Merge K Sorted Lists – Python 3 (Week 16 – 02)
Heapify – Python 3 (Week 16 – 01)
Reorganize String – Python 3 (Week 13 – 04)
heapq is a binary heap, with O(log n) push and O(log n) pop. Solution 1 Time O(n). Space O(1).