Tuesday, April 20, 2010

Hashtable (hashmap)

Description
a data structure that uses a hash function to efficiently map certain identifiers or keys (e.g., person names) to associated values (e.g., their telephone numbers). The hash function is used to transform the key into the index (the hash) of an array element (the slot or bucket) where the corresponding value is to be sought.

Advantages
+ Speed

Drawbacks
- Hard to get efficient hash function
- Hard to enumerate values

Example
+ Person name to phone number lookup
- Spell-check application - not sorted

No comments: