What is the complexity of selection sort algorithms?

20212021

What is the complexity of selection sort algorithms?

  1. A.

    O(n)

  2. B.

    O(n log₂ n)

  3. C.

    O(n²)

  4. D.

    O(2n)

Attempted by 535 students.

Show answer & explanation

Correct answer: C

For each position, Selection Sort scans the remaining unsorted portion to find the minimum element.

Total comparisons:

(n−1)+(n−2)+⋯+1=(n(n−1))/2

Thus, the complexity is quadratic.

Explore the full course: Up Lt Grade Assistant Teacher 2025