Skip to content

Instantly share code, notes, and snippets.

@cipepser
Created January 15, 2017 07:59
Show Gist options
  • Save cipepser/a7dace84aae086af18858a69693ad9c4 to your computer and use it in GitHub Desktop.
Save cipepser/a7dace84aae086af18858a69693ad9c4 to your computer and use it in GitHub Desktop.
package MySort
func BubbleSort(a []int) {
for i := 0; i < len(a) - 1; i++ {
for j := 0; j < len(a) - i - 1; j++ {
if a[j] > a[j + 1] {
a[j], a[j + 1] = a[j + 1], a[j]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment