682 views
1 votes
1 votes

Suppose we are sorting(increasing/ decreasing) an array of 10 unsorted elements. We have just finished some heapify(max heapify/ min heapify) operations. The array now looks like: 9, 8, 10, 7, 5, 6, 4, 3, 2, 1. How many heapify operations have been performed on the root so far ?

1 Answer

Best answer
2 votes
2 votes

As it is told in question We have just finished some heapify

So, there must we found some heap trees

We tried first with min heap operation. There no leaf satisfies minheap operations

So, now try with max heap

So, 4 max heap sub trees we found , though root 9 stillneed to heapify

selected by

Related questions

2 votes
2 votes
1 answer
1
Thor-o-s asked Sep 1, 2022
427 views
Can anyone please explain how to find “ i “ smallest elements from an array whose elements are distinctPlease use max heap to explain the working input : n distinct e...
0 votes
0 votes
1 answer
2
2 votes
2 votes
1 answer
3
Nandkishor3939 asked Jan 15, 2019
3,396 views
I was going through the heap concept and one question came into my mind what will be the best case time complexity of finding the minimum element in a max heap?Thank you:...
0 votes
0 votes
1 answer
4
saurav raghaw asked Dec 22, 2018
696 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)