3 ms·
Just looked at the kth largest algorithm and author claims max heap method is k log n ! His method is actually n log n. The min heap is n log k and the right wa
by anilshanbhag 10y ago
Just looked at the kth largest algorithm and author claims max heap method is k log n ! His method is actually n log n. The min heap is n log k and the right way to do it.
- coder007 10y agoit is clearly O(klogn). We are popping k times from a heap of size n.