next up previous index
Next: Hashing Up: Data Structures Previous: Code and demonstration   Index


Hash Tables

A major concern of the theory of data structures and algorithms is the efficient storage and retrieval of data. Unless data are stored in some structured way, the only method of retrieval is to sift laboriously through the pile. The time to retrieve an individual item will then increase at least proportionately to the size of the pile. Ideally we should like a way of retrieving data which increases only logarithmically, for example, with the size of the pile. Better still, we should like the retrieval time to be constant.

So far we have used comparability of data items, with respect to some ordering relation, to assist in efficient retrieval. If $n$ data items are stored in an ordered array, it should be possible to recover each of them in ${\cal O}(\log n)$ time using binary search. The same is true if they are stored in a binary search tree, provided the tree is sufficiently well balanced. Similar remarks hold for searching for whether or not an item is present.



Subsections

Peter Williams 2005-06-07