why dictionaries are more useful than list
Answers
Answered by
8
Explanation:
When the keys of the dictionary are 0, 1, ..., n, a list will be faster, since no hashing is involved. As soon as the keys are not such a sequence, you need to use a dict.
Answered by
6
Answer:
Dictionary uses a hash lookup, while your list requires walking through the list until it finds the result from beginning to the result each time. to put it another way. The list will be faster than the dictionary on the first item, because there's nothing to look up. ... The larger the list, the longer it takes.
Similar questions