Skip to content

Commit

Permalink
更新模版代码注释
Browse files Browse the repository at this point in the history
  • Loading branch information
itcharge committed Sep 10, 2023
1 parent 9f9e8f4 commit 87ba74a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Templates/01.Array/Array-BubbleSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def bubbleSort(self, nums: [int]) -> [int]:
# 第 i 趟「冒泡」
for i in range(len(nums) - 1):
flag = False # 是否发生交换的标志位
# 从数组中前 n - i + 1 个元素的第 1 个元素开始,相邻两个元素进行比较
# 对数组未排序区间 [0, n - i - 1] 的元素执行「冒泡」
for j in range(len(nums) - i - 1):
# 相邻两个元素进行比较,如果前者大于后者,则交换位置
if nums[j] > nums[j + 1]:
Expand Down
2 changes: 1 addition & 1 deletion Templates/01.Array/Array-InsertionSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def insertionSort(self, nums: [int]) -> [int]:
j = i
# 从右至左遍历有序区间
while j > 0 and nums[j - 1] > temp:
# 将有序区间中插入位置右侧的元素依次右移一位
# 将有序区间中插入位置右侧的所有元素依次右移一位
nums[j] = nums[j - 1]
j -= 1
# 将该元素插入到适当位置
Expand Down

0 comments on commit 87ba74a

Please sign in to comment.