mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 02:46:30 +08:00
Merge branch 'Cathay-Chen-master'
This commit is contained in:
commit
31f062d3d5
1 changed files with 1 additions and 1 deletions
|
@ -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…
Reference in a new issue