-
Hashing - Linear Probing
Help....I'm hoping someone can do a better job explaining 'hashing - linear probing' than this book I'm reading. I'm just looking for the explaination, not any code. I'm trying to insert 'EASYQUTION' into an initally empty hash table witha size of M = 16. I'm using the hash function 11k mod M to transform the kth letter into a table index. If anyone can explain the process or send me a link it would be greatly appreciated.
-
A hashing algoritm is just an expression to create a unique value for given data(most hashing algorithms i have seen only produce a limited amount of unique values).
an example of a hashing algorithm I have uses vehicle registrations as its data:
say you had the reg number B123BCD:
the algorithm is, take the integer value of the first letter 'B' and subtract 'A' from it, then multiply the result by 1000. So far we have a value of 1000. Next we add the next 3 digits 123, so now we have a value of 1123. This is our unique value(actually this method only produces 26000 different values). So you would store the registration number in position 1123 of the array/file.
You need to make sure your data is in the correct format and if data already exists in the position 1123, i would write the new data to an error file or just tell the user, i wouldn't try to store it elsewhere because retriving it using the same algorithm would get the wrong data.
Hope this helps.
-
-
I'm not sure whether the link will work or not...... sorry.
-
unable to get to that site...anyone else have any ideas??