Need Help in Determining Hash Key for -ve numbers in a array
Anonymous User
26

Generally to solve hashing questions i take hash key to be the array element.
For the array [1,8,6,4,10] i would be storing element 1 at index 1,element 8 at index 8 , element 6 at index 6 and so on.
For Strings i use hash key to be as ascii of char%26 and store it at the index.
But i am facing a problem if i have negative number in a array.
Ex; [1,-10,8,-6]
Using previous hash function i cannot store -10 to be at index -10 .
Can anyone suggest me some hash function for this scenario.

Comments (0)