C Program To Implement Dictionary Using Hashing Definition
Hashing is an important Data Structure which is designed to use a special function called the Hash function which is used to map a given value with a particular key for faster access of elements. The efficiency of mapping depends of the efficiency of the hash function used. Let a hash function H(x.
Hello everyone first time here but i'd like to start by first asking if my understanding of double hashing is correct.
Double hashing works by first implementing a hash function then checking to see if that spot is open. if the current spot is not open then using a second hash function determine another spot and then multiply it by the current attempt and then add it to the index spot that was determined by the first hashing algorithm.
the current code i'd have is:
i just realized i didnt include my second hash function
it may not look like it but in the real deal tsize is being called correctly.
templatetypedef2 Answers
C Program To Implement Dictionary Using Hashing Definition In Math
Your if statement is incorrect:
Should be:
or better yet, since you're wasting more than the % op by doing the if, and the answer is the same regardless, you can just get rid of the if altogether:
JoelJoelOr you could completely simplify it by saying
Which accomplishes the same thing while making the while loop a lot smaller (and getting rid of the extra variable). I'm assuming you don't want to allow duplicates (hence the second condition in the while loop?).
adinutzyc21
adinutzyc21