Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- N = 1000
- list1 = []
- for i in range(0, N):
- list1.append(random.randint(0, N-1))
- list2 = list(list1)
- print '\nRandom Integer String:\n\n', list2
- # Bubble Sort
- for i in range(0, len(list2) - 1):
- swap_test = False
- for j in range(0, len(list2) - i - 1):
- if list2[j] > list2[j + 1]:
- list2[j], list2[j + 1] = list2[j + 1], list2[j]
- swap_test = True
- if swap_test == False:
- break
- print '\n\nSorted Integer String:\n\n', list2
Advertisement
Add Comment
Please, Sign In to add comment