A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 5 years ago
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
anonymous
 5 years ago
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

This Question is Closed

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0int findIndex ( char *arr ) { int sum , x , i , b , z ; i = 0; int y = strlen(arr); x = arr[0]; x = (x*x)%10; b = arr[1]; z = arr[2]; z = (z*z); sum = xb+z; return (sum%64); }

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I have this hash function , it gives 20 collissions . Is this a correct hash function ? Also how can i make it a perfect hash function

myininaya
 5 years ago
Best ResponseYou've already chosen the best response.0omg i don't know this much about hash functions i only really know about the math behind it i;m sorry :(

shadowfiend
 5 years ago
Best ResponseYou've already chosen the best response.2How much capacity will your hashtable have? That will decide whether you will find it possible to have a perfect hash function or not.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0hash table can be of 128 size at maximum

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I 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).

shadowfiend
 5 years ago
Best ResponseYou've already chosen the best response.2Ok, 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.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Thanks alot everyone! :)
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.