how the O(N) is the right ans?
According to me, the ans should be O(log N)
Q5 about the deletion from heap
hello @arsalaan997
Time complexity will be O(N+log(n) )
first we need to find the node that we want to delete (it will take O(n))
in worst case.
and then we will delete it which will furthur take O(log(N))
SO OVERALL time complexity will be O(n+log(n))
which is O(n)
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.