MCPcopy Create free account
hub / github.com/0xAX/go-algorithms / BubbleSort

Function BubbleSort

sorting/bubble_sort.go:7–15  ·  view source on GitHub ↗

* * Bubble sort - http://en.wikipedia.org/wiki/Bubble_sort */

(arr []int)

Source from the content-addressed store, hash-verified

5 */
6
7func BubbleSort(arr []int) {
8 for i := 0; i < len(arr); i++ {
9 for j := 0; j < len(arr)-1-i; j++ {
10 if arr[j] > arr[j+1] {
11 arr[j],arr[j+1] = arr[j+1],arr[j]
12 }
13 }
14 }
15}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected