C Program To Implement Selection Sorting Using Linear Array:
Algorithm scans through the data, looking for either the smallest or the largest element(depending upon you) in the set and then swapsit with the first or the last element of Data set. Now find the smallest item from the data set excluding the first that is already sorted, andreplace that element with the Second element. Similarly the loop continues until the last two items in the data set. Now the Data is sorted.

Note: The above Selection sort, described uses swapping of data which makes the algorithm Unstable, while Selection sort can also be implemented as Stable sort, by selecting the smallest element and putting the element before the first element of the list i.e. instead of swapping the first element with the smallest element, we are sweeping the first element to second position, second to third and so on.



ALGORITHM:-

step 1 : start
step 2 : Input Element in array
step 3 : Set mininum element to location of zero
step 4 : Search the mininum element in the array
step 5 : Swap the value with the Min Location
step 6 : Increments Min to point of the next Element
step 7 : Repeat this process until array in sorted
step 8 : Print the Sorted Element
step 9 : Stop the Excution


PROGRAM CODE:-

#include<stdio.h>
#include<conio.h>
int main()
{

    int array[1000],n,i,min,temp;
 
    printf("Enter the number of element you want to Sort : ");
    scanf("%d",&n);

    //taking input in array
    printf("Enter Elements in the list : ");
    for(i = 0; i < n; i++)
    {
        scanf("%d",&array[i]);
    }
 
    //Perform the sorting procedure
    for (i = 0; i < n; i++)
    {
        min = i;
        for(j = i + 1; j < n; j++)
        {
            if(array[min] > array[j])
            {
                 min = y;
            }
            temp = array[i];
            array[i]   = array[j];
            array[j] = temp;            
        }
    }

    //Value of the array after sorting
    printf("Sorted list : ");
    for(i = 0; i < n; i++ )
    {
        printf("%d\t",sortArray[i]);
    }
}


OUTPUT:-

Enter the number of element you want to sort: 6
Enter Element in the Array
8 9 12 45 -22 56

Sorted Array
-22 8 9 12 45 56


C Program To Implement Selection Sorting
Write a Program to Sort an Array Using Selection Sort
Sort data Element of an array using selection