Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import time
  2. import itertools
  3.  
  4. def all_perms(elements):
  5. t1 = time.clock()
  6. for i in range(len(elements)):
  7. t0 = time.clock()
  8. itertools.permutations(range(i))
  9. each = time.clock() - t0
  10. print(each)
  11. final = time.clock() - t1
  12. print("The total time is: ", final)
  13.  
  14. #---------------------------------------------------------------------------------------------------
  15. # TESTING:
  16.  
  17. # Test 1
  18. test_list_1 = [1,2,3,4,5]
  19. all_perms(test_list_1)
  20. # Test 2
  21. #test_list_2 = [1,2,3,4,5,6,7,8,9,10]
  22. #all_perms(test_list_2)
  23. # Test 3
  24. #test_list_3 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
  25. #all_perms(test_list_3)
  26. # Test 4
  27. #test_list_4 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
  28. #all_perms(test_list_4)
  29. # Test 5
  30. #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]
  31. #all_perms(test_list_5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement