Chapter 6. Dictionaries: Keyed Collections
A dictionary is an abstract data structure that can be described as a collection of keys and associated values, where each key only appears once within the collection. This associated relationship between the keys and values is why dictionaries are sometimes referred to as associative arrays. Dictionaries are also known as maps, or more specifically, hash maps for hash table-based dictionaries and tree maps for search tree-based dictionaries. The four most common functions associated with a dictionary are add, update, get, and remove. Other common operations include contains, count, reassign, and set. Each of these operations will be examined in detail later in this chapter.
The mapped, or associative, nature of dictionaries allows for extremely efficient insert, search, and update operations. By specifying the key when creating, editing, or getting a value, most operations in a well-designed dictionary have a minimal O(1) cost. Perhaps...