diff --git a/Bubble sort b/Bubble sort new file mode 100644 index 0000000..9b739c5 --- /dev/null +++ b/Bubble sort @@ -0,0 +1,24 @@ +lstlen = int(input()) +lst = [int(x) for x in input().split()] + +nr = True +x = 0 + +while True: + while x < ((lstlen) - 1): + if lst[x] > lst[x + 1]: + a, b = lst[x], lst[x + 1] + lst[x], lst[x+1] = b, a + x += 1 + nr = False + else: + x += 1 + if nr: + break + else: + lstlen -= 1 + nr = True + x = 0 + +for j in range(len(lst)): + print(lst[j],end=" ") \ No newline at end of file