Sorting is a procedure in which the given elements are arranged in ascending or descending order. For example if the elements of an array are –
5, 11, 15, 8, 7, 54, 63, 44
After sorting these elements in ascending order, the elements would be –
5, 7, 8, 11, 15, 44, 54, 63
What is Selection Sort is :
Suppose that you are given some numbers and asked to arrange them is ascending order. The most intuitive way to do this would be to find the smallest number and put it in the first place and then find the second smallest number and put it in the second place and so on. This is the simple technique on which selection sort is based. It is named so because in each pass it selects the smallest element and keeps it in its exact place. Let’s now see the c program to sort an array using selection sort.