This repository has been archived on 2025-12-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2024-09-20 14:17:13 +03:00

14 lines
365 B
Python

def BubbleSort(lst, order):
lit = list(lst)
for i in range(len(lit)):
for j in range(0, len(lit) - i - 1):
if lit[j] > lit[j + 1]:
lit[j], lit[j + 1] = lit[j+1], lit[j]
if type(lst) == tuple:
lit = tuple(lit)
if order == 1:
return lit
elif order == 2:
lit.reverse()
return lit