retagged by
1,035 views

1 Answer

0 votes
0 votes

if you have a heap(either min or max) if we delete first element then it coll heapify . and it will take logn .

so delete 1st element ------------->logn

delete 2nd element------------->logn

           ;

            ;

delete ith element --------------> logn 


logn +logn+logn.................(upto i)

logn(1+1+............................)

logn * i

i(logn)------> O(logn)

Related questions

0 votes
0 votes
1 answer
1
saurav raghaw asked Dec 22, 2018
686 views
The time complexity of the most efficient algorithm to determine whether an arbitrary array of size ‘n’, is min-heap or not?(A) O(log n)(B) O(n)(C) O(n logn)(D) O(1)
1 votes
1 votes
1 answer
2
Avijit Shaw asked Dec 21, 2018
4,393 views
What is the time complexity of 'deleting any random node from a max or min heap'?
1 votes
1 votes
1 answer
3
gmrishikumar asked Dec 1, 2018
2,296 views
What is the time complexity to find the Kth largest element in a Min-Heap? Or equivalently, What is the time complexity to find Kth smallest element in Max-Heap?
0 votes
0 votes
0 answers
4
srestha asked Aug 16, 2018
1,051 views
a)Deletion of smallest element in heapb)Insertion of an element in a heap will take$O(n)$ or $O(logn)$ time?