This is a creation in Article, where the information may have evolved or changed.
has been very little contact with the algorithm and the like (I use PHP), I suddenly looked at it today and written out in the go language. Like the go language very much, there may be
A little Google complex bar ~. The hair is recorded here, but also hope to be the same as my beginners help.
Here is the code, note that in go to pass the array parameter will be automatically converted to slice, and slice is a reference type , sorting algorithm is not good or bad I do not judge, nor very understand.
Bubble sort func mpsort (array []int) {for I:=0;i<len (array), i++ {for J:=0;j<len (array)-i-1;j++ {if array[j] > Array[j +1] {array[j], array[j+1] = array[j+1], array[j]}}}}//Quick sort func quickSort (array []int, left int, right int) {if left < R ight {key: = Array[left]low: = Lefthigh: = Rightfor Low < high {to low < high && Array[high] > key {high --}array[low] = Array[high]for Low < high && Array[low] < key {Low++}array[high] = Array[low]}array[low] = k Eyquicksort (array, left, low-1), QuickSort (array, low+1, right);}}