Selection sort is a simple comparison-based sorting algorithm. It works by repeatedly finding the minimum element (considering ascending order) from the unsorted part and putting it at the beginning.
Steps of Selection Sort:
- Initialize the minimum value’s index (
min_idx) to the first element’s index of the unsorted subarray. - Iterate through the unsorted subarray to find the actual minimum element.
- Swap the found minimum element with the first element of the unsorted subarray.
- Move the boundary of the unsorted subarray by one element to the right





