Skip to content

Instantly share code, notes, and snippets.

@msiddiqi
Created February 17, 2020 17:02
Show Gist options
  • Save msiddiqi/23f06fb423123b778220627fcf431888 to your computer and use it in GitHub Desktop.
Save msiddiqi/23f06fb423123b778220627fcf431888 to your computer and use it in GitHub Desktop.
public static void doSelectionSort(int[] arr)
{
for (int index = 0; index < arr.Length; index++)
{
var minIndex = index;
var item = arr[index];
for (int j = index; j < arr.Length; j++)
{
if (arr[minIndex] > arr[j])
{
minIndex = j;
}
}
arr[index] = arr[minIndex];
arr[minIndex] = item;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment