Selection Sort Algorithm

Selection sort is a simple sorting algorithm. Divide the array into two arrays, sorted and unsorted. Then   selects the smallest element from an unsorted list in each iteration and places that element at the sorted array one by one. This process continues moving unsorted array boundary by one element to the sorted array.

Let’s consider an array with values { 12, 4, 45, 2, 10}

Step 1- It will find the min number from array elements so here its 2 so will will swap 12 with number 2

Step 2 – start iteration from second element of array and search the min number of array do and perform the same steps

Selection Sort Example in C#

Leave a Reply

Your email address will not be published. Required fields are marked *