Algorithms

Heap sort

A sorting algorithm that builds a heap and removes the root over and over. O(n log n) and in place.

Example

With a max-heap of [3, 9, 1], out come 9, 3 and 1, left at the end one by one: [1, 3, 9].

Test yourself: Heap sort

Heap sort

Heap sort builds a ___-heap to sort from smallest to largest.

Lessons that use it

More algorithms terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.