Stability
Warm-up · Multiple choice · about 4 min
Heap sort sorts the cards 5a, 5b, 3 by number only. The letters just tell the two 5s apart. Which result does heap sort give, and what does it show?
Example 1
Input:
{"values":["5a","5b","3"]}
Output:
["3","5b","5a"]
Learn the idea first: Heap sort, a visual lesson.
More Heap sort problems
- State after two extractions Standard
- Implement heap sort Standard
- The k largest values Standard
- Spot the bug: the heap that never shrinks Standard
- Sort nearly sorted data with a small heap Challenge