A minimum heap is a list of numbers such that the number is smaller than the and numbers. For example, is a minimum heap because
Conversely, a maximum heap is a list of numbers such that the number is larger than the and numbers.
True or False?
If I reverse a minimum heap , I always get a maximum heap .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
You can make a minimum heap that is not in ascending order because the 5th (although 4th, 6th, and 7th work as well) can be made very big. This will give us a heap that when reversed has a very large number in the 3rd slot. We can make this number bigger than the one in the first. One example is {1, 4, 2, 5, 7, 3, 3} if the logic is still not clear. Reversing it, we obtain {3, 3, 7, 5, 2, 4, 1}. If we look at the first and compare to the second and third, it should be greater than both. However, you can see that three isn't greater than either, and therefore, the heap is not a maximum heap. We have proved the statement false.