Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. def load_dictionary(hash_table,filename,time_limit):
  2. file = open(filename, 'r')
  3. f = file.readlines()
  4.  
  5. start1 = timeit.default_timer()
  6.  
  7. for line in f:
  8. hash_table.__setitem__(line,1)
  9.  
  10. stop1 = (timeit.default_timer() - start1)
  11.  
  12. file.close()
  13.  
  14. if start1-stop1 > time_limit:
  15. raise IndexError
  16. return stop1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement