Exercise 10 (make_hash_table) problem

I initialize hash_table = {i: for i in range(num_buckets)}

Then initialize id_table = {j: for j in range(num_buckets)}

For the provided example these are

hash_table = {0: , 1: , 2: , 3: , 4: , 5: , 6: , 7: }

id_table = {0: , 1: , 2: , 3: , 4: , 5: , 6: , 7: }

But sometimes the hash value is calculated more than 7 (for instance 224)

244 doesn’t belong to the keys

can someone explain to me what i am doing wrong?

Thanks in advance

Please check the value for num_buckets. It should be 1024.

1 Like