Skip to main contentSkip to solution

Given array [50, 40, 60, 30, 70]

How many passes will be required to sort the array using a selection sort?

Solution

✅ Correct Option: 3

Selection sort places one element in its final position per pass. After n−1n - 1 passes the last element is automatically in place, so for n=5n = 5 the number of passes is 5−1=45 - 1 = \boxed{4}.

PassPosition filledMinimum found in unsorted partArray after pass
11st3030, 40, 60, 50, 70
22nd4030, 40, 60, 50, 70
33rd5030, 40, 50, 60, 70
44th6030, 40, 50, 60, 70

Option 4 (5): a fifth pass would only compare the last element with itself, 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