Selection Sort-1
Selection Sort-1
Selection Sort
In selection sort, the smallest value among the unsorted elements of the
array is selected in every pass and inserted to its appropriate position into the
array. It is also the simplest algorithm. It is an in-place comparison sorting
algorithm. In this algorithm, the array is divided into two parts, first is
sorted part, and another one is the unsorted part. Initially, the sorted part of
the array is empty, and unsorted part is the given array. Sorted part is placed
at the left, while the unsorted part is placed at the right
Selection Sort
In selection sort, the first smallest element is selected from the unsorted
array and placed at the first position. After that second smallest element is
selected and placed in the second position. The process continues until the
array is entirely sorted.
Usage of Selection Sort
Selection sort is generally used when –