Sorting

AP Computer Science A· difficulty 4/5

Selection sort first iteration on [4, 1, 3, 2]:

  • A

    [2, 1, 3, 4]

  • B

    [1, 2, 3, 4]

  • C

    [1, 4, 3, 2] (smallest moves to front)

    check_circle
  • D

    [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?

Related questions