Exams › GATE › Technical
Which one of the following is the tightest upper bound that represents the number of swaps required to sort n numbers using selection sort?
- O(log n)
- O(n)
- O(n log n)
- O(n²)
Correct answer: O(n)
Solution
Selection sort requires a linear number of swaps, specifically one swap for each of the n elements in the worst case, making O(n) the tightest upper bound for the number of swaps.
Related GATE Technical questions
⚔️ Practice GATE Technical free + battle 1v1 →