Selection Sort
In this lesson, we'll cover how selection sort works and see its implementation.
We'll cover the following
Selection sort
Maintain two parts of the array, sorted and unsorted parts. Starting with the sorted part being empty and the unsorted part being , repeatedly find the smallest integer in the unsorted part and swap it to the end of the sorted part.
A small example will explain the process quickly. In this example, the unsorted part is bold.
- Step :
- Step : find minimum in and move to 0 -> .
- Step : find minimum in and move to 1 -> .
- Step : find minimum in and move to 2 -> .
Get hands-on with 1400+ tech skills courses.