There was an error while loading. Please reload this page.
1 parent dd1408f commit fadb0b8Copy full SHA for fadb0b8
Bubblesort/Bubblesort.go
@@ -23,14 +23,14 @@ func compdesc(arg1 float64, arg2 float64) bool {
23
}
24
25
// simple implementation of the bubblesort-algorithm
26
-func bubblesort(numbers *[]float64, sortfunc compare) {
+func bubblesort(numbers *[]float64, compfunc compare) {
27
max := len(*numbers) - 1
28
if max > 0 {
29
flag := true // swapped?
30
for flag {
31
flag = false
32
for i := 0; i < max; i++ {
33
-if sortfunc((*numbers)[i], (*numbers)[i+1]) {
+if compfunc((*numbers)[i], (*numbers)[i+1]) {
34
flag = true
35
(*numbers)[i], (*numbers)[i+1] = (*numbers)[i+1], (*numbers)[i] // swap values
36
0 commit comments