Merge pull request #22 from yyeltsyn/patch-1

Update bubble_sort.py
This commit is contained in:
Chetan Kaushik 2016-08-26 17:13:58 +05:30 committed by GitHub
commit abd9d78a62

View File

@ -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]