Skip to content

Instantly share code, notes, and snippets.

@Yapcheekian
Last active July 28, 2021 01:46
Show Gist options
  • Save Yapcheekian/def399ad2978faf9cb24f2fe494f6db1 to your computer and use it in GitHub Desktop.
Save Yapcheekian/def399ad2978faf9cb24f2fe494f6db1 to your computer and use it in GitHub Desktop.
selection sort, bubble sort, insertion sort, merge sort, quick sort
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