On a recent exam, my prof gave us a list of data (8 total) and each corresponding hash index. What I was to find was the hash function. How in the world does one go about doing such a thing?
An example of the data he presented:
h(1141) = 1
h(7732) = 5
h(9455) = 3
etc...
Thank you.
a hashing questionsolving for a hash function
Page 1 of 1
5 Replies - 2194 Views - Last Post: 30 April 2008 - 12:27 AM
Replies To: a hashing question
#2
Re: a hashing question
Posted 29 April 2008 - 11:49 PM
I thought the point of a hash was to be unable to find the equation (if it was a "good" hash)
#3
Re: a hashing question
Posted 30 April 2008 - 12:02 AM
KYA, on 29 Apr, 2008 - 11:49 PM, said:
I thought the point of a hash was to be unable to find the equation (if it was a "good" hash)
well this function can obviously be found easily if it's on an exam. but yea, you are right. what a retarded question. i should just write the answer you just gave me on the test.
#4
Re: a hashing question
Posted 30 April 2008 - 12:08 AM
That's what I would do
, but let's see if we can work this out. The has is applied to the number in () and the result is on the right side of the equals....
HMMMM....
I would look at the whole list (can you post it?) and see if a relationship can be determined among the answers. The type of program using this hash would also be helpful since often hashs are made with similariity to the program in order to eliminate duplicates.
HMMMM....
I would look at the whole list (can you post it?) and see if a relationship can be determined among the answers. The type of program using this hash would also be helpful since often hashs are made with similariity to the program in order to eliminate duplicates.
#5
Re: a hashing question
Posted 30 April 2008 - 12:20 AM
it's actually an exam question i do not have access to at the moment.
i just realized something. our linear probing has to have at least an 80% loading factor, which means for 8 data keys, we need 10 slots. the function key%10 + 1 should fill slots 1-10. really the only function we have worked with is mod, and i found some notes in which he describes doing it in this way.
this works. but thanks for your help.
i just realized something. our linear probing has to have at least an 80% loading factor, which means for 8 data keys, we need 10 slots. the function key%10 + 1 should fill slots 1-10. really the only function we have worked with is mod, and i found some notes in which he describes doing it in this way.
this works. but thanks for your help.
#6
Re: a hashing question
Posted 30 April 2008 - 12:27 AM
Glad it hopefully will work out to be a lot less complicated then i was imaginating
Page 1 of 1

New Topic/Question
Reply



MultiQuote



|