You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bro, thank you for your code. But your way of using heap will lead to $n^2logn$ time rather than nlogn, since you are using buildHeap in every iteration, and it is nlogn. The right method is to use heap with lazy delete to achieve O(nlogn) complexity.