mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
17 lines
379 B
Python
17 lines
379 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
# author: bt3gl
|
|
|
|
|
|
def bubble_sort(list)
|
|
|
|
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]
|
|
has_swapped = True
|