Merge branch 'Cathay-Chen-master'
This commit is contained in:
commit
31f062d3d5
@ -908,7 +908,7 @@ $$
|
|||||||
```go title="time_complexity.go"
|
```go title="time_complexity.go"
|
||||||
/* 平方阶(冒泡排序) */
|
/* 平方阶(冒泡排序) */
|
||||||
func bubbleSort(nums []int) int {
|
func bubbleSort(nums []int) int {
|
||||||
count := 0 // 计数器
|
count := 0 // 计数器
|
||||||
// 外循环:待排序元素数量为 n-1, n-2, ..., 1
|
// 外循环:待排序元素数量为 n-1, n-2, ..., 1
|
||||||
for i := len(nums) - 1; i > 0; i-- {
|
for i := len(nums) - 1; i > 0; i-- {
|
||||||
// 内循环:冒泡操作
|
// 内循环:冒泡操作
|
||||||
|
Loading…
x
Reference in New Issue
Block a user