I'm working with an app that is cpu-bound more than memory bound, and I'm trying to merge two things whether they be lists or dicts.
Now the thing is i can choose either one, but I'm wondering if merging dicts would be faster since it's all in memory? Or is it always going to be O(n), n being the size of the smaller list.
The reason I asked about dicts rather than sets is because I can't convert a set to json, because that results in {key1, key2, key3} and json needs a key/value pair, so I am using a dict so json dumps returns {key1:1, key2:1, key3:1}. Yes this is wasteful, but if it proves to be faster then I'm okay with it.
Edit: My question is the difference in using dict and list for merging, I originally and mistakenly had dict and set listed.
dict1 = {"the" : {"1":1, "3":1, "10":1}
dict2 = {"the" : {"11":1, "13":1}}
after merging
dict3 = {"the" : {"1":1, "3":1, "10":1, "11":1, "13":1}