umm well a string of three characters ( T,C,G,A) , from among these, will be given to the hash function which will generate an index. Can i simply do something like this, if the input is TTT index is 0 , if TCT , index is 1 and so on
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
int findIndex ( char *arr )
int sum , x , i , b , z ;
i = 0;
int y = strlen(arr);
x = arr;
x = (x*x)%10;
b = arr;
z = arr;
z = (z*z);
sum = x-b+z;
I have this hash function , it gives 20 collissions . Is this a correct hash function ? Also how can i make it a perfect hash function
omg i don't know this much about hash functions
i only really know about the math behind it
i;m sorry :(
Not the answer you are looking for? Search for more explanations.
:( its ok :)
How much capacity will your hashtable have? That will decide whether you will find it possible to have a perfect hash function or not.
hash table can be of 128 size at maximum
I imagine there are different implementations of hash. You will have some collisions depending on the number of different inputs you have. Although you can build your own hash functions as you describe above, the built in implementations are likely to be more efficient and set up so that the compiler can optimize them better than probably anything you would write. If your task is not specifically to build a hash implementation, I would go with the built in class(es).
Ok, if the table can be 128 size maximum, 4 letters 3 at a time gives you a maximum of 24 permutations, so you know you can find a perfect hash function.
You need to basically figure out a way that each possible string can be assigned a number from 0 to 24, and then any hashtable size above 23 will have a perfect hash function for it.