hashmap module.
Several utility methods are already completed, including
iterators and __repr__. However, none of the
methods for inserting or searching in the map are
written. There is a main function that runs several
quick tests. If you try to run this module you should see
a NotImplementedError.
__contains__, __getitem__,
and __setitem__ methods according to the
provided docstrings. For now, don't worry about re-sizing
the hash table when MAX_LOAD is exceeded. When these
methods are correct, the module should produce the
following output when executed:
No assertions! Looks good.
_searchEntry helper
method.
__setitem__ method so that
rehashing occurs when the load factor exceeds LOAD_FACTOR.
The new size should be a prime number around twice the
size of the current table. When you have completed the
code, rerun the module to make sure that it still passes
the tests.
_nextPrime function to
find appropriate primes.
time_hashing.py and then run it.
Do the results make sense? What happens when you change
the load factor from 1.0 to .1? 10? 100?
__delitem__ and pop. These are
slightly more challenging. Recall that removing items
from a linked list requires you to locate both the node
to be removed, and the node that precedes it.