Is selection sort stable?
Standard · Multiple choice · about 3 min
Selection sort runs on [3a, 3b, 1], where 3a and 3b have the same key 3. A sort is stable when equal keys keep their input order. Is selection sort stable?
Example 1
Input:
["3a","3b","1"]
Output:
["1","3b","3a"]
Constraints
- 3a and 3b compare as equal.
Learn the idea first: Selection sort, a visual lesson.
More Selection sort problems
- State after two passes Warm-up
- Count comparisons Warm-up
- Implement selection sort Standard
- The k smallest values Standard
- Selection sort of pairs by key Challenge