Computer Science EngineeringHard

The maximum number of swaps performed by selection sort on n elements is

  1. A. n
  2. B. n - 1
  3. C. n^2/2
  4. D. n log n

Correct answer: B. n - 1

Selection sort performs at most one swap per position for the first n-1 positions.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic