'Linear probing hash table issue
I have recently learnt about linear probing as a collision handling method for hash tables, but I was wondering how that relates to the hash function. For example: You have a hash table of size 2, and the number 32 returns a hash of 0. Therefore you set index 0 of the list to the value associated with the key. Imagine you do this with a different number, for example 48, and you also get a hash of 0, and handle the collision using linear probing, leaving the value associated with the key 48 at index position 1 in the list. However, I was wondering what you would do when you try to access the value associated with 48? Since hashing 48 returns 0, the hash table would return the value associated with the number 32 instead of the one associated with 48. How would you fix this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
