Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

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

OpenStudy (anonymous):

Okay, you have 4 distinct characters and a hash function. You input a string, of a certain length and only containing only those characters, into this hash function Now, is the input string of fixed length? Like is it always three characters long?

OpenStudy (anonymous):

just take the lexigraphical value of the string (ie. T-84, C-67, G-71, A-65) add them all together (if string is "AAA" then 65+65+65) and then modulo (%) that result by the size of your hash table. (if hash table has index size of 10 then result%10) and thats your index

OpenStudy (anonymous):

yes, the input string is of fixed length i.e 3 like TGC or TTT etc.

OpenStudy (anonymous):

umm can you tell me what is lexigraphical value ? :$

OpenStudy (anonymous):

A character's ASCII value: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters ChadBro's hash function is sufficient, though not perfect. This is because you can have two inputs that have the same group of characters but in different ordering. In other words, TAG and GAT would collied.

OpenStudy (anonymous):

ohh yes this is what i was thinking :) Thanks alot

OpenStudy (anonymous):

i don't think there can be a perfect hash function for this problem :S Some collissions would be there :S

OpenStudy (anonymous):

can you please help me with this ?? How to make a hash function with minimum number of collissions in this case ? :(

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!