Selection Sort Program in C

Write a selection sort program in C. Given an unsorted array, write a c code to sort an array using selection sort.

For example :

Input : {9, 8, 19, 2, 3 }
Output : { 2, 3, 8, 9, 19}

What is Selection Sort?

Selection sort is an in-place comparison technique. In selection sort, we pick minimum element and move an element to it’s correct position. We repeat this process until all the elements are sorted.

The time complexity of selection sort is O(n^2). It is not suitable for large data sets.

Bubble Sort Program in Java