Skip to content

Binary heap

storing

Level 2 of 3

Also called Priority queue and Min-heap.

A row of numbers read as a tree, with the smallest always on top. A new number goes at the end of the row and climbs while it is smaller than the number above it; taking one out takes the top, moves the last number up, and lets it sink back down.

comparisons
0
swaps
0

step 1 of 1

Examples

A number from 1 to 99 puts it in, and a dash on its own takes the smallest out. Up to 12 of them, at most 7 put in, separated by commas or spaces, for example 31, 12, 47, -.