Skip to content

Commit eb325e8

Browse files
committed
revised InsertionSort
1 parent 247c984 commit eb325e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SortingAlgorithms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# not optimized, equiv to while version below, but uses for loop
1414
def insertion_sort1(A):
1515
for i in range(1, len(A)):
16-
for j in range(i-1, 0, -1):
16+
for j in range(i-1, -1, -1):
1717
if A[j] > A[j+1]:
1818
A[j], A[j+1] = A[j+1], A[j]
1919
else:

0 commit comments

Comments
 (0)