Skip to main contentSkip to solution

If the list have 'n' elements then how many passes/iteration will the selection sort take to sort the array?

Solution

✅ Correct Option: 1

Selection sort fixes one element in its final position in each pass: pass 1 puts the smallest element at index 0, pass 2 puts the next smallest at index 1, and so on. After n−1n-1 passes, the last remaining element is already in its correct place, so no extra pass is needed.


Option 2: nn passes is a common guess, but the last pass would only compare the final element with nothing.

Option 4: n2n^2 is the time complexity, i.e. the order of the number of comparisons, not the number of passes.

Keyboard Shortcuts

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