All simulations
Algorithms
·
Sorting
Heap Sort
The list that is secretly a tree — watch both views move together.
Fold list into tree
Ready
–
Phase
0
Comparisons
0
Swaps
✓ Sorted
READY
Same colour and label (L0, L1 …) = same tree level, in tree and list
Compared now
✓ In final place
× Broken link · child bigger than parent
Skip tour
Next
Quiz · Heap Sort
Question 1 of 5
Choose one
In a list used as a heap, where are the children of position 3?
2 and 4
4 and 5
7 and 8
6 and 7
Choose one
In a max-heap, where is the largest item?
At the last position
At the root, position 0
In the middle
Anywhere — heaps are unordered
Choose one
During sift down, a parent is smaller than both children. Which child does it swap with?
The larger child
The smaller child
The left child, always
Whichever is nearer the end
Choose one
What is heap sort’s running time on an already-sorted list?
O(n)
O(n²)
O(n log n)
O(log n)
Select all that apply
Which statements about heap sort are true?
It needs O(n) extra memory
It sorts in place
It is stable
Equal items can change order
To improve
Your answers