mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-28 07:21:07 +00:00
Merge pull request #231 from TheAlgorithms/revert-22-patch-1
Revert "Update bubble_sort.py"
This commit is contained in:
commit
bfd52dfa42
|
@ -31,8 +31,8 @@ def bubble_sort(collection):
|
||||||
[-45, -5, -2]
|
[-45, -5, -2]
|
||||||
"""
|
"""
|
||||||
length = len(collection)
|
length = len(collection)
|
||||||
for i in range(length-1, -1, -1):#range(length-1, -1, -1)
|
for i in range(length):
|
||||||
for j in range(i):#range(1, i)
|
for j in range(length-1):
|
||||||
if collection[j] > collection[j+1]:
|
if collection[j] > collection[j+1]:
|
||||||
collection[j], collection[j+1] = collection[j+1], collection[j]
|
collection[j], collection[j+1] = collection[j+1], collection[j]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user