Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bubble_sort(int_list):
- num_1 = 0
- num_2 = 0
- counter = 0
- complete = False
- while complete == False:
- swaps = 0
- while counter < len(int_list) - 1:
- if int_list[counter] > int_list[counter+1]:
- num_1 = int_list[counter]
- num_2 = int_list[counter+1]
- int_list[counter+1] = num_1
- int_list[counter] = num_2
- swaps += 1
- counter += 1
- if swaps == 0:
- complete = True
- counter = 0
- return int_list
Advertisement
Add Comment
Please, Sign In to add comment