next up previous contents index CD CD Algorithms
Next: Binary Search Trees Up: Fundamental Data Types Previous: Containers

Dictionaries

 

Dictionaries are a form of container that permits access to data items by content. You put a word into a dictionary because you know you can look it up when you need it.  

The primary operations dictionaries support are:

Perhaps the simplest possible dictionary implementation maintains an unsorted linked list as a data structure. Insertion and deletion are supported in constant time, although a query requires potentially traversing the entire linked list. Basing an implementation on a stored array speeds up the query operation to tex2html_wrap_inline23940 by binary search. Making room for a new item or filling a hole left by a deletion may require moving arbitrarily many items, so insertion and deletion become linear-time operations.

Many other dictionary implementations are available. Binary search trees are discussed in some detail in the next section. Hash tables are another attractive option in practice. A complete discussion of different dictionary data structures is presented catalog Section gif. We encourage the reader to browse through the data structures section of the catalog in order to learn what your options are.

Certain dictionary data structures also efficiently support the following useful operations:


next up previous contents index CD CD Algorithms
Next: Binary Search Trees Up: Fundamental Data Types Previous: Containers

Algorithms
Mon Jun 2 23:33:50 EDT 1997