Multiple choice

Which one of the following is the tightest upper bound that represents the number of swaps required to sort n numbers using selection sort?

  1. O(log n)

  2. O(n)

  3. O(n log n)

  4. O(n2)

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The maximum number of swaps that takes place in selection sort on n numbers is O(n).