feat(Go-Tool):新增选择排序及其单测、冒泡排序及其单测、堆排序及其单测
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* @Author : huangzj
|
||||
* @Time : 2020/8/20 11:21
|
||||
* @Description:冒泡排序
|
||||
*/
|
||||
|
||||
package sort
|
||||
|
||||
func BubbleSort(list []int) {
|
||||
for i := 0; i < len(list); i++ {
|
||||
for j := i + 1; j < len(list); j++ {
|
||||
if list[i] > list[j] {
|
||||
list[i], list[j] = list[j], list[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user