mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 12:16:14 -04:00
Update bubble_sort.py
This commit is contained in:
parent
2e7f4a9410
commit
d357be4e52
@ -1,16 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# author: bt3gl
|
||||
|
||||
|
||||
def bubble_sort(list)
|
||||
def bubble_sort(array)
|
||||
|
||||
has_swapped = True
|
||||
|
||||
while has_swapped:
|
||||
has_swapped = False
|
||||
|
||||
for i in range(len(lst) - 1):
|
||||
if lst[i] > lst[i + 1]:
|
||||
lst[i], lst[i + 1] = lst[i + 1], lst[i]
|
||||
for i in range(len(array) - 1):
|
||||
if array[i] > array[i + 1]:
|
||||
array[i], array[i + 1] = array[i + 1], array[i]
|
||||
has_swapped = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user