Computer Science I / Sorting Strategies
Practice question · Put in order

Order the steps of one round of selection sort.

Hints
  1. Selection sort repeatedly finds the smallest remaining element and places it.
  2. You must find the minimum before you can place it.
Show the answer
  1. Scan the unsorted part to find the smallest remaining element
  2. Swap it into the first unsorted position
  3. Shrink the unsorted part by one
  4. Repeat until the unsorted part is empty
Why

Find the smallest remaining element, put it next, shrink the unsorted region, and repeat. Placing before finding would be impossible, the minimum must be located first.

Read the lesson: Sorting Strategies →

Practise Sorting Strategies

The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Sorting Strategies