mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-12 23:36:06 +00:00
build
This commit is contained in:
@@ -87,8 +87,8 @@ comments: true
|
||||
=== "Python"
|
||||
|
||||
```python title="bubble_sort.py"
|
||||
""" 冒泡排序 """
|
||||
def bubble_sort(nums):
|
||||
""" 冒泡排序 """
|
||||
n = len(nums)
|
||||
# 外循环:待排序元素数量为 n-1, n-2, ..., 1
|
||||
for i in range(n - 1, 0, -1):
|
||||
@@ -295,8 +295,8 @@ comments: true
|
||||
=== "Python"
|
||||
|
||||
```python title="bubble_sort.py"
|
||||
""" 冒泡排序(标志优化) """
|
||||
def bubble_sort_with_flag(nums):
|
||||
""" 冒泡排序(标志优化) """
|
||||
n = len(nums)
|
||||
# 外循环:待排序元素数量为 n-1, n-2, ..., 1
|
||||
for i in range(n - 1, 0, -1):
|
||||
|
||||
Reference in New Issue
Block a user