Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import itertools
- def all_perms(elements):
- t1 = time.clock()
- for i in range(len(elements)):
- t0 = time.clock()
- itertools.permutations(range(i))
- each = time.clock() - t0
- print(each)
- final = time.clock() - t1
- print("The total time is: ", final)
- #---------------------------------------------------------------------------------------------------
- # TESTING:
- # Test 1
- test_list_1 = [1,2,3,4,5]
- all_perms(test_list_1)
- # Test 2
- #test_list_2 = [1,2,3,4,5,6,7,8,9,10]
- #all_perms(test_list_2)
- # Test 3
- #test_list_3 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
- #all_perms(test_list_3)
- # Test 4
- #test_list_4 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
- #all_perms(test_list_4)
- # Test 5
- #test_list_5 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
- #all_perms(test_list_5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement