A dictionary maps keys to values allowing efficient retrieval of values by keys. Use the [map-function] tag for mapping functions; use the [maps] tag for geography.
A dictionary (also known as map, associative array, or symbol table) in computer science is a data structure that maps keys to values such that given a key its corresponding value can be efficiently retrieved.
It is commonly implemented as a hash map which allow O(1)
amortized lookup. Alternatively, they may be implemented as a sorted list, with lookup requiring a binary search and making the lookup O(log N)
amortized instead.
When tagging a question with dictionary, be sure to tag it with the language being used as well.
In C++
std::map<Key, T, Compare, Allocator>
: A sorted associative container that contains key-value pairs with unique keys.
In .NET
Dictionary<TKey, TValue>
: Represents a collection of keys and values.
In Python
dict
: Maps hashable keys to arbitrary objects.
In Java
Map<K, V>
: An object that maps keys to values.
See also
Related tags: associative-array, unordered-map, multimap, treemap, hashmap, hashtable, lua-table
For questions about Mapping Functions over collections of data, use map-function tag.
For questions about the Geographical maps i.e. for visual representation of area, please use maps tag