HASH_INIT Name
HASH_INIT Purpose
Initialize a hash table.
Category
Calling Sequence
hash_init Inputs
Keyword Parameters
Keywords
KEY=key Input string array of keys.
VAL=val Input string array of values.
N_MAIN=nm Input number of entries in the main table.
N_OVER=no Input number of entries in the overflow table.
HASH=h Returned hash table in a structure.
COLLISIONS=ncoll Returned number of collisions on set up.
Outputs
Common Blocks
Notes
Notes: User must also provide a hash function which takes
one key and converts it to an index into the hash table.
This hash function must be called hash_f and take a single
string arg (the key) and return a long int (the index into
the hash table). A default hash function will be used
unless the user hash function is found on the IDL path
first (or is compiled). The default hash function just
sums the ascii codes of the letters in the key and does
mod 6000 (so make n_main be 6000 if using the default
hash function. Try n_over=100 or so and check # of
collisions to see how close, or check h.next).
A hash table allows a value to be looked up based on a
given text string, the key. This version of hash_init
uses strings for both the keys and values (can be
generalized later).
Modification History
R. Sterner, 2004 Mar 29
Copyright (C) 2004, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.