The selection sort algorithm sorts an array by repeatedly finding the minimum element from unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array.
1) The subarray which is already sorted.
2) Remaining subarray which is unsorted.
In every iteration of selection sort, the minimum element from the unsorted subarray is picked and moved to the sorted subarray.
Time Complexity: O(n2)
Worst Complexity : n^2
Average Complexity : n^2
Auxiliary Space: O(1)
Python program for implementation of Selection Sort:
a=[64, 34, 25, 82, 22, 11, 90]
for i in range(len(a)):
for j in range(i+1,len(a)):