清风细雨楼 Design By www.eepep.com
//冒泡排序
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]
      }
    }
  }
}
//快速排序
func quickSort(array []int, left int, right int) {
  if left < right {
    key := array[left]
    low := left
    high := right
    for low < high {
      for low < high && array[high] > key {
        high--
      }
      array[low] = array[high]
      for low < high && array[low] < key {
        low++
      }
      array[high] = array[low]
    }
    array[low] = key
    quickSort(array, left, low-1);
    quickSort(array, low+1, right);
  }
}

以上所述就是本文的全部内容了,希望大家能够喜欢。

清风细雨楼 Design By www.eepep.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
清风细雨楼 Design By www.eepep.com