Skip to content

Commit fadb0b8

Browse files
committed
A bit of refactoring
1 parent dd1408f commit fadb0b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Bubblesort/Bubblesort.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ func compdesc(arg1 float64, arg2 float64) bool {
2323
}
2424

2525
// simple implementation of the bubblesort-algorithm
26-
func bubblesort(numbers *[]float64, sortfunc compare) {
26+
func bubblesort(numbers *[]float64, compfunc compare) {
2727
max := len(*numbers) - 1
2828
if max > 0 {
2929
flag := true // swapped?
3030
for flag {
3131
flag = false
3232
for i := 0; i < max; i++ {
33-
if sortfunc((*numbers)[i], (*numbers)[i+1]) {
33+
if compfunc((*numbers)[i], (*numbers)[i+1]) {
3434
flag = true
3535
(*numbers)[i], (*numbers)[i+1] = (*numbers)[i+1], (*numbers)[i] // swap values
3636
}

0 commit comments

Comments
 (0)