fix: stack_operations.png, bubble_sort.py

pull/253/head^2
Yudong Jin 2 years ago
parent 8ba1f64710
commit fc221b19da

@ -12,7 +12,7 @@ from include import *
def bubble_sort(nums):
n = len(nums)
# 外循环:待排序元素数量为 n-1, n-2, ..., 1
for i in range(n - 1, -1, -1):
for i in range(n - 1, 0, -1):
# 内循环:冒泡操作
for j in range(i):
if nums[j] > nums[j + 1]:
@ -23,7 +23,7 @@ def bubble_sort(nums):
def bubble_sort_with_flag(nums):
n = len(nums)
# 外循环:待排序元素数量为 n-1, n-2, ..., 1
for i in range(n - 1, -1, -1):
for i in range(n - 1, 0, -1):
flag = False # 初始化标志位
# 内循环:冒泡操作
for j in range(i):

@ -100,7 +100,7 @@ comments: true
def bubble_sort(nums):
n = len(nums)
# 外循环:待排序元素数量为 n-1, n-2, ..., 1
for i in range(n - 1, -1, -1):
for i in range(n - 1, 0, -1):
# 内循环:冒泡操作
for j in range(i):
if nums[j] > nums[j + 1]:
@ -288,7 +288,7 @@ comments: true
def bubble_sort_with_flag(nums):
n = len(nums)
# 外循环:待排序元素数量为 n-1, n-2, ..., 1
for i in range(n - 1, -1, -1):
for i in range(n - 1, 0, -1):
flag = False # 初始化标志位
# 内循环:冒泡操作
for j in range(i):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Loading…
Cancel
Save