Selection Sort
When sorting using selection sort algorithm, There are two parts as unsorted and sorted parts while sorting. Minimum value is selected from sorted part and swapped with the leftmost element of the unsorted part of the array.
Example is given below,
Example is given below,
In this algorithm, every time minimum element is selected from unsorted part and swapped with leftmost element |
10 is the smallest value |
10 is swapped with 14 |
14 is the smallest value in the unsorted part |
Swap 14 with 14(in is already on the leftmost of the array) |
15 is the smallest from index 2 to 5 |
15 is swapped with 76 |
53 is the smallest in unsorted part |
53 is swapped with 76 |
72 is the smallest in the unsorted array |
Swapping 72 and 76 |
76 is the smallest |
Array is sorted |
Thanks for sharing such a wonderful blog !
ReplyDeleteDocker Training in Hyderabad
Docker and Kubernetes Online Training
Docker Training