Is Dict.update() Computationally Efficient Or Are There More Efficient Alternatives?
I'm running code which uses 16 processes to build up 16 dictionaries of length approximately 62,500 (that's about 1,000,000 in total). After each process finishes I update a single
Solution 1:
The time complexity in python is documented here.
As @MicahSmith already answered (in the comments) the complexity with updating a dict is O(1) in the average and O(n) in Amortized Worst Case. This is due it iterating over the dict keys and values.
Post a Comment for "Is Dict.update() Computationally Efficient Or Are There More Efficient Alternatives?"