Created
February 17, 2020 17:02
-
-
Save msiddiqi/23f06fb423123b778220627fcf431888 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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