[Solved] What are the Similarities between Dictionary and Array data types? [closed]


A dictionary maps strings to values.

An array maps integers to values.

That is about it!

So, seriously: in the end, both data structures map a “key set” to values. For dictionaries, the keys can of (almost) arbitrary type, without any constraint on them (besides being “hash able”). Whereas an array maps a consecutive range of ints to values.

From that point of view, arrays and dicts/maps are doing the same thing, but in the end, how you use them is very different.

And just for completeness: of course, the “underlying” similarity is that both are “containers”: objects that “own” multiple other objects.

1

solved What are the Similarities between Dictionary and Array data types? [closed]