Skip to main contentSkip to solution

The number of passes, selection sort makes to sort a list of 'n' elements is ____.

Solution

✅ Correct Option: 3

Selection sort finds the smallest element in the unsorted part in each pass and swaps it into its correct position. After n−1n-1 passes, n−1n-1 elements are in their final places, so the last element is automatically in place and no extra pass is needed.

For example, a list of 5 elements needs 4 passes.


Option 2: nn passes is a common guess, but the last pass would compare the single remaining element with nothing, so it is not needed.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question