Skip to content

Building a heap

storing

Level 2 of 3

Also called Heapify, Floyd's method and Bottom-up heap construction.

Turn a whole row into a heap at once, every number at least as big as its children. The numbers with no children are heaps of one already. Sift each parent down, from the last back to the first, and the parts below it are always heaps by then.

the row

the row as a tree

comparisons
0
swaps
0

step 1 of 1

Examples

Whole numbers from 1 to 99, between 2 and 7 of them, separated by commas or spaces.