Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- list_to_sort = [randint(1,100) for i in range(33)]
- print(list_to_sort)
- def mbubble_sort(sorted):
- n = len(sorted)
- while (n >= 1 ) :
- newn = 0
- for i in range(1, len(sorted)):
- if sorted[i-1] > sorted[i]:
- sorted[i-1], sorted[i] = sorted[i], sorted[i-1]
- newn = i
- n = newn
- return sorted
- mbubble_sort(list_to_sort)
- print(list_to_sort)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement