python - How does the look up time of nested dictionaries increase? -


can comment on how complexity of dictionaries increases "nest" them further?

e.g add element follows:

dict_name[a][b][c][d] = 0 

i think lookup time should same dictionary (constant time o(1)), change if add elements this?

dict_name[a][b][c]....[z] 

python's dictionary implementation doesn't change nesting, no, algorithmic complexity of lookup not change. far python concerned, each [key] subscription independent object subscribing came from.

each lookup still o(1). looking nested element depth times o(1) lookup. since hard-coded depth (by using literal notation), have still o(1) constant multiplier doesn't affect big-o complexity.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -