Last active
July 28, 2021 01:46
-
-
Save Yapcheekian/def399ad2978faf9cb24f2fe494f6db1 to your computer and use it in GitHub Desktop.
selection sort, bubble sort, insertion sort, merge sort, quick sort
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
func selectionSort(items []int) { | |
for x := 0; x < len(items) - 1; x++ { | |
min := x | |
for y := x+1; y < len(items); y++ { | |
if items[y] < items[min] { | |
min = y | |
} | |
} | |
items[x], items[min] = items[min], items[x] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment