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
- # Insertion Sort
- for i in range(1, len(list2)):
- hold = list2[i]
- j = i
- while j > 0 and list2[j - 1] > hold:
- list2[j] = list2[j - 1]
- j -= 1
- list2[j] = hold
- print '\n\nSorted Integer String:\n\n', list2
Advertisement
Add Comment
Please, Sign In to add comment