Selection Sort is a simple sorting algorithm in which the smallest element in the array is found and swapped with the element in the first position, then it finds the second smallest element and swaps it with the element in the second position, and the process is continued until the entire array is sorted.
Let’s take the following array: [4, 1, ,6 ,3]
Step 1: The smallest element is 1. We swap it with the first element.
Result: [1, 4, 6, 3]
Step 2: The second smallest is swapped with the second element.
Result: [1, 3, 4,6]
Step 3: The third smallest is swapped with the third element.
Result: [1, 3,4, 6]
The array is now sorted.
The algorithm is efficient for smaller lists, but very inefficient for larger lists. Also, it does not require any additional storage space, as it operates in-place.