A dictionary (or map) in computer science is a data structure that maps keys to values such that given a key its corresponding value can be efficiently retrieved


A map is a data structure relating keys to values. For questions about mapping functions use [map-function] instead. For questions about geography, use [maps] instead.

Examples constant factor

Quality Example
Slower std

"For suitably large examples of each dictionary overcomes the constant factor by which it s slower than std map and will actually do operations like lookup insertion etc"

from question "Idiomatic way to do list/dict in Cython?"

Worse algorithmic

"I definitely wouldn t try introducing a new general-purpose type for use in python based on std map which has worse algorithmic complexity in time for many important operations andâ in at least some implementationsâ leaves some optimisations to the user that dictionary already has"

from question "Idiomatic way to do list/dict in Cython?"


"Std map though is actually implemented in a way that many operations are slower than dictionary as its size gets large"

from question "Idiomatic way to do list/dict in Cython?"


Quality Example
Slightly better

"Map is slightly better because the shared dictionary has around 480 entries instead of around 450 but it s still inconsistent and not all 500 as expected"

from question "Python multiprocessing Pool / Process has inconsistent results"


"If what you are making is a map from one word to another you might be better off with a dictionary"

from question "Objective C Array of Array of Strings"


"Data structure to implement reverse functionality of a dictionary that is more than one key map to a common value using python"

from question "Data structure to implement reverse functionality of a dictionary"

"Using this hint we can try to guess that a fixmap must correspond to a dictionary data type in c# since a map is more or less like a dictionary of key-value pairs"

from question "Trying to get msgpack-cli to give me the same packed byte array as it does in JavaScript"

"The difference between a map and vector is a like an array while a map is more a dictionary of key value pairs"

from question "Clojure hashmaps as generalized vectors"

"C++ std map behaves more like a python defaultdict than dictionary"

from question "Why does += work on std::map keys that don't have values?"

Much more

"I know this question is a bit older but in es2015 there is a new data structure called map that is much more similar to a dictionary that you would use in c#"

from question "C# Dictionary equivalent in JavaScript"

Implementation faster

"The immutable dictionary implementation is faster but no less pure in usage than the map implementation"

from question "Can someone point me to examples of multiparadigm (object-functional) programming in F#?"

Back to Home
Data comes from Stack Exchange with CC-BY-SA-3.0