The time complexity of insertion operation is O(log N) while time complexity of build heap is O(N Log N)?n
Time complexity doubt in binary heap
@Ayush-Kokande-2816457821730452 yes!
insertion/deletion costs logN time complexity where N is elements in heap.
To build a heap, if you do N insertions, then total complexity turns out to be N * logN
So insertion operation only refers to the time complexity of addition of a single element which is O(Log N)
Yes it is correct!
as
insertion/deletion costs logN time complexity where N is elements in heap.
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.