Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Hashing using linear probing
- TABLE_SIZE = 10
- # Define some sample customer records
- customer_records = [
- [45876, "Tom's data"],
- [32390, "Yanmeng's data"],
- [95312, "George's data"],
- [64636, "Xinwu's data"],
- [23467, "Yi Shangri's data"]]
- def hash(key):
- pass
- def insert(new_record, hash_table):
- pass
- def find_record(search_key, hash_table):
- pass
- my_hash_table = [None] * TABLE_SIZE
- for record in customer_records:
- ''' insert every record into my_hash_table '''
- # Tests
- print(find_record(45871, my_hash_table))
- print(find_record(45872, my_hash_table))
- print(find_record(23467, my_hash_table))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement