Is an array sorted in nondecreasing order always a minheap? Can the opposite be said—that the elements of a minheap are always sorted in nondecreasing order? Explain.
What will be an ideal response?
An array sorted in nondecreasing order is always a minheap because the top level will be the smallest value and each level will see the values increase, meaning the children will never be larger than the parent node.
The opposite need not be true. For example, the array { 2, 5, 3} represents a valid minheap, but is not sorted in nondecreasing order.
Computer Science & Information Technology
You might also like to view...
You can select ________ ranges by selecting the first cell range, and then, holding down the [Ctrl] button while selecting the second cell range
Fill in the blank(s) with correct word
Computer Science & Information Technology
You should apply an artistic effect before compressing a picture.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology