Algorithm
Selection Sort Algorithm:
- Start with an unsorted array.
- For each element in the array:
- Set the current element as the minimum.
- Traverse the remaining unsorted portion of the array.
- If a smaller element is found, update the minimum to this element.
- Swap the minimum element with the first unsorted element.
- Repeat the process for the next unsorted element until the entire array is sorted.
Example:

Fig. 1: Iteration by Iteration Visualization of Selection Sort
Note: Selection Sort ensures that, after each pass, the smallest unsorted element is placed in its correct position.