@TeamNYK Your point is clear now.
The answer is:
the min oriented priority queue here actually is a minHeap and its size will be
k then the
popping complexity will be
log(k). That's the reason for the complexity
@HarryChaoyangHe Nice summary, thanks for sharing!
Actually if you want to share a
summary like this one, you could just post it in
General Discussion. Don't try to paste it
everywhere, okay? Thank you so much!
How to do that?
New Topicbutton then select the topic
Categoryhere it will be
@babhishek21 Your point is clear now. But did you really try its performance and just
theoretically talking about it? As far as I tried it for
1000 times by local script using 1 million to 10 million random arrays, it turned out its performance is acceptable.
@babhishek21 Er, strictly speaking almost all
solutions have the worst cases, so here you are trying to be particular about that kind of cases?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.