Let's say I have a group of key-value pairs that I plan to store in a hash table. The population is fixed and will never change. What optimizations are available to me to make a hash table as fast as possible? What optimizations should I focus on? This suggests that I have a lot of space. There will be a reasonable number of pairs (say, no more than 100,000).
EDIT: I want to optimize the search. I don't care how long it takes to build.
I would make sure your key hash has unique values. This ensures that every search is constant, and therefore as fast as possible.
100 000 , 100 000 -.
, , , int, ( 100 000) , . ( 1). , - . .
int
1
, -, , , - .
, - . , , ,
, . , O (1). .
. .
- , , . .
, -, -.
, 100 . . Java MPH package, .
, - (MPH). Wikipedia Java, .
int hashCode class. , , .
hashCode
class
, 100K, , . . , , , 23 , , 365 .
, , 100K?
, - , , n- . , , 26 , .
26 . , f f , . . o. , o. ( , !). , , , , .
, . , , 4- . , , , . , foo, , , , foo.
, Google , .
, . ( .) , , -. , .. - , , .
, Java - : hashCode . -, -.
, , -, . hashCode, , , - . , , 100 , hashCode 1, 1001, 2001, 3001, 4001, 5001,... 99001. - 100 000 , . . 1000 , . .
, -. . , - . , . , , - , : . , , , "1".
, , . , ?