Selection Sort



Selection Sort is another simple sorting algorithm that works by repeatedly finding the smallest (or largest, depending on the order) element from the unsorted part of the array and swapping it with the first unsorted element. It divides the array into two parts: a sorted part and an unsorted part, and progressively grows the sorted part.

How it Works:


1->Start with the first element (this is the boundary between the sorted and unsorted portions).

2->Find the smallest element in the unsorted portion of the array.

3->Swap the smallest element with the first element of the unsorted portion, effectively growing the sorted portion.

4->Move the boundary of the sorted and unsorted portions one step to the right.

5->Repeat the process until the entire array is sorted.