I was asked this interview question. I am not sure what the correct answer for it is (and the reasoning behind the answer):
Is sin(x) a good hash function?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you mean
sin(), it’s not a good hashing function because:xit’s no better than justxitself. There should be no seemingly apparent relationship between the key and the hash of the key.sin(), it may not work with a different compiler or on a different kind of CPU/computer.sin()may be much slower than some simpler integer-arithmetic function.