feat(Go-Tool):新增选择排序及其单测、冒泡排序及其单测、堆排序及其单测

This commit is contained in:
huangzj
2020-08-20 18:05:48 +08:00
parent c2aca17567
commit f4f18b3866
7 changed files with 213 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
/*
* @Author : huangzj
* @Time : 2020/8/20 11:28
* @Description
*/
package sort
func SelectSort(list []int) {
var minPoint int
for i := 0; i < len(list); i++ {
minPoint = i
for j := i + 1; j < len(list); j++ {
if list[j] < list[minPoint] {
minPoint = j
}
}
list[i], list[minPoint] = list[minPoint], list[i]
}
}