I know the basic principle of a hash table data structure. If I have a hash table of size N, I must equally distribute my data in these N-buckets.
But in fact, most languages have built-in hash tables. When I use them, I do not need to know the size of the hash table in advance. I just put whatever I want into it. For example, in Ruby :
h = {} 10000000.times{ |i| h[i]=rand(10000) }
How can I do that?
Lai yu-hsuan
source share