previous | start | next

Sorting an Array of Integers

  1. Find the smallest and swap it with the first element
    5 9 17 11 12

  2. Find the next smallest. It is already in the correct place
    5 9 17 11 12

  3. Find the next smallest and swap it with first element of unsorted portion
    5 9 11 17 12

  4. Repeat
    5 9 11 12 17

  5. When the unsorted portion is of length 1, we are done
    5 9 11 12 17

previous | start | next