Complexity of selection sort

Selection sort also looks similar to bubble sort and has two for loops with 0 to n. The basic difference between bubble sort and selection sort is that, selection sort makes maximum n-1 number of swapping, whereas bubble sort can have n*n number of swapping, in the worst case scenario. However, in the selection sort, the best case, worst case, and average case have similar complexity. Here is the complexity chart for selection sort:

Best time complexity

Ω(n2)

Worst time complexity

O(n2)

Average time complexity

Θ(n2)

Space complexity (worst case)

O(1)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset