Sep 2, 2018 · 1 min read
I am not clear about the time complexity analysis. Maintaining the priority_queue has the time complexity of O(nlog n). Then why is the whole algorithm’s time complexity O(n)?
I am not clear about the time complexity analysis. Maintaining the priority_queue has the time complexity of O(nlog n). Then why is the whole algorithm’s time complexity O(n)?