Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. # Hashing using linear probing
  2.  
  3. TABLE_SIZE = 10
  4.  
  5. # Define some sample customer records
  6. customer_records = [
  7. [45876, "Tom's data"],
  8. [32390, "Yanmeng's data"],
  9. [95312, "George's data"],
  10. [64636, "Xinwu's data"],
  11. [23467, "Yi Shangri's data"]]
  12.  
  13.  
  14. def hash(key):
  15. pass
  16.  
  17.  
  18. def insert(new_record, hash_table):
  19. pass
  20.  
  21.  
  22. def find_record(search_key, hash_table):
  23. pass
  24.  
  25.  
  26. my_hash_table = [None] * TABLE_SIZE
  27.  
  28. for record in customer_records:
  29. ''' insert every record into my_hash_table '''
  30.  
  31. # Tests
  32. print(find_record(45871, my_hash_table))
  33. print(find_record(45872, my_hash_table))
  34. print(find_record(23467, my_hash_table))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement