c++ program for selection sort code example
Example: how to make a selection sort C++
void selectionSort(int array[], int size)
{
int minIndex, minValue;
for (int start = 0; start < (size - 1); start++)
{
minIndex = start;
minValue = array[start];
for (int index = start + 1; index < size; index++)
{
if (array[index] < minValue)
{
minValue = array[index];
minIndex = index;
}
}
swap(array[minIndex], array[start]);
}
}