A key is an identifier associated with a value. It tells a dictionary where to find that value, such as a baseball player's name identifying cards and collection details. section 12.1
Dictionary operations use keys in several practical ways:
- Insert a value using its key, retrieve the associated value by searching for that key, and delete by key, value, or reference. section 12.3
- A key may be extracted from a value, supplied separately as a key–value pair, or computed with a hash function. section 12.3
- When keys are strings, extracting an integer identifier may require processing each character, adding a cost that can be treated as constant only when bounded. section 12.11
Baseball-card lookup
A collection app can use a player's name or a card photograph as a key, then retrieve the number of copies owned and related card details. A hash table converts the key into a valid array index when the array cannot hold every possible key. section 12.1 section 12.13









