Selection sort first iteration on [4, 1, 3, 2]:
- A
[2, 1, 3, 4]
- B
[1, 2, 3, 4]
- Ccheck_circle
[1, 4, 3, 2] (smallest moves to front)
- D
[4, 1, 3, 2]
Explanation
Find min (1), swap with first → [1, 4, 3, 2].
AP Computer Science A· difficulty 4/5
Selection sort first iteration on [4, 1, 3, 2]:
[2, 1, 3, 4]
[1, 2, 3, 4]
[1, 4, 3, 2] (smallest moves to front)
[4, 1, 3, 2]
Explanation
Find min (1), swap with first → [1, 4, 3, 2].
Want 10 more like this — adaptive to your weak spots?