For Large Dictionaries Could One Use Separate Dictionaries Where Each Dictionary Covers an Interval of the Input Range?

skip at pobox.com skip at pobox.com
Tue May 16 14:53:19 EDT 2006


    Graham> Looking up a key in a dictionary is done in constant-time,
    Graham> i.e. it doesn't matter how large the dictionary is.

Doesn't that depend on how many keys hash to the same value?  For small
dictionaries keeping the max keys that hash to the same value small isn't a
huge problem.  For large dictionaries (millions of keys) might you have some
long chains?  Or in an effort to reduce the chain length, wind up using so
much virtual memory that you wind up wrecking performance by swapping?

Skip



More information about the Python-list mailing list