What is the time complexity of selection sort algorithm in c?

total no of comparisons are 3(n)

total no of comparisons are n(n+1)/2

total no of comparisons are (n-1)n/2

total no of comparisons are n^2

total no of comparisons in the above selection sort algorithm are (n-1)n/2 and + 3n cell movements , which is potentially equal to n^2. so time complexity of selection sort is O(n^2).

Back To Top