Doubt regarding time complexity

In the approach video given, the time complexity is mentioned as O(logN). Should it not be O(NlogN) since we’re inserting N array elements into priority queues?

Yeah, I think they meant that calculating one running median costs us log N time, and so for N elements the amortized complexity is O(N log N).

2 Likes

Closing this topic as your issue has been resolved by the community. If not Kindly un-mark the accepted solution to re-open the topic or feel free to create a new topic and post a link to this topic as a reference.