The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) 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 (considering ascending order) from the unsorted subarray is picked and moved to the sorted subarray.
Sorted array: 11 12 22 25 64
Time Complexity: O(N2)
Auxiliary Space: O(1)
Please refer complete article on Selection Sort for more details.
Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.