0 votes 0 votes I think it is loglogn mehul vaidya asked Jan 3, 2019 mehul vaidya 425 views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments mehul vaidya commented Jan 3, 2019 reply Follow Share But number of comparison will be loglogn because as heap is balanced tree , it has height of logn now to find appropriate place for root element , we have to travel maximum height of logn , and we can do binary search on this logn elements. hence effectively loglogn 0 votes 0 votes mehul vaidya commented Jan 3, 2019 reply Follow Share ok fine i understood , we can not perform binary search on logn elements , because we don't know which path will root element follow. hence we don't know elements on which we can perform binary search 0 votes 0 votes prashant jha 1 commented Jan 3, 2019 reply Follow Share So in this case a deletion in min heap or max heap should also take loglogn ? You have a valid point on number of comparisons , but time complexity depends too on number of swaps and at each level in worst case 1 swap happens so in log n height logn swaps occur. And time complexity always takes the higher order terms. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes it will take O(nlogn) where n is no of node and logn is height of tree gorya506 answered Aug 14, 2019 gorya506 comment Share Follow See all 0 reply Please log in or register to add a comment.