Skip to content

Instantly share code, notes, and snippets.

@linfongi
Created January 27, 2016 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linfongi/6b075aa0b715f2c2d668 to your computer and use it in GitHub Desktop.
Save linfongi/6b075aa0b715f2c2d668 to your computer and use it in GitHub Desktop.
func insertionSort(arr []int) {
for idx := range arr {
for j := idx; j > 0 && arr[j-1] > arr[j]; j-- {
arr[j], arr[j-1] = arr[j-1], arr[j]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment