Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 993df1a

Browse files
committedJun 3, 2019
amend insertion_sort
1 parent 4efdf73 commit 993df1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎sorts/insertion_sort/insertion_sort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def insertion_sort(unsorted_collection):
2323
while index > 0 and unsorted_collection[index - 1] > unsorted_collection[index]: # 前一个元素大于后一个元素
2424
unsorted_collection[index], unsorted_collection[index - 1] = unsorted_collection[index - 1], \
2525
unsorted_collection[index]
26-
index -= 1 # 只保持前面已经排列的有序,这点和冒泡相反,冒泡每次排序都保证末端有序
26+
index -= 1 # 只保持前面已经排列的有序,这点和冒泡相反,冒泡每次排序都保证末端有序
2727
return unsorted_collection
2828

2929

0 commit comments

Comments
 (0)
Please sign in to comment.