695 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

434
views
1 answers
2 votes
Thor-o-s asked Sep 1, 2022
434 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...
755
views
1 answers
0 votes
atulcse asked Jan 16, 2022
755 views
Consider the following graph:Find the total number of max-heap possible orderings with elements 12, 10, 1, 5, 7, 9, 8 such that each element is filled in one node of the ...
3.4k
views
1 answers
2 votes
Nandkishor3939 asked Jan 15, 2019
3,441 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:...
702
views
1 answers
0 votes
saurav raghaw asked Dec 22, 2018
702 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)