The time complexity of pushing n elements into the priority queue will be nlog(n) right?
if yes then how will using priority queue help decrease the time complexity?
I have a doubt regarding time complexity
in what context are u saying… using priority queue helps reducing complexity in many questions where it may even take O(n^2)
like say i have to find top 10 scorers from a data of 10000 people, so in this case if we use priority queue, baat same hi padegi sorting wali
Priority queue may be usefull when i have toremove say 2-3 elements and then insert some elements again into the data
ya so it depends on ques to ques
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.