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...

Explain the hierarchy of interfaces to support List objects as documented in the textbook. Explain why specific methods appear in particular interfaces.

What will be an ideal response?

Computer Science & Information Technology

You can build complex formulas using arithmetic operators, parentheses, and a mixture of _____.

A. both constants and values B. both values and cell references C. cell references only D. values only

Computer Science & Information Technology

Magnetic storage became popular because it was ________.

a) fast, inexpensive and persistent b) rewritable, inexpensive and persistent c) rewritable, fast and persistent d) inexpensive, fast and reliable

Computer Science & Information Technology

Subforms always display all the fields from the underlying table

Indicate whether the statement is true or false

Computer Science & Information Technology