mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Update bubble_sort.py
This commit is contained in:
parent
456995580b
commit
ab8340cac7
@ -30,7 +30,7 @@ def bubble_sort(collection):
|
||||
[-45, -5, -2]
|
||||
"""
|
||||
length = len(collection)
|
||||
for i in range(length):
|
||||
for i in range(length-1):
|
||||
for j in range(length-1):
|
||||
if collection[j] > collection[j+1]:
|
||||
collection[j], collection[j+1] = collection[j+1], collection[j]
|
||||
|
Loading…
Reference in New Issue
Block a user