What is the complexity of selection sort algorithms?
20212021
What is the complexity of selection sort algorithms?
Answer: C. O(n²) — 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…
- A.
O(n)
- B.
O(n log₂ n)
- C.
O(n²)
- D.
O(2n)
Attempted by 1317 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.
Loading lesson…