mirror of
https://github.com/jlengrand/Coding4Interviews.git
synced 2026-03-10 08:11:24 +00:00
Actually, I have to provide two inputs to add instead, use one to create the key and store the other in the table. This is the classical implementation of HM
This commit is contained in:
@@ -7,20 +7,6 @@ Collisions are not handled in this version.
|
||||
2013/11
|
||||
"""
|
||||
|
||||
import abc
|
||||
|
||||
class HashMapItem():
|
||||
"""
|
||||
The type of Object that is ingested by HashMap
|
||||
It can be as simple as a String, but must have a get_value() method.
|
||||
The get_value method will be used to calculate the hash key
|
||||
"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_value(self):
|
||||
return NotImplementedError("Method has to be implemented by sub classes")
|
||||
|
||||
class HashMap():
|
||||
def __init__(self, hash_size=513):
|
||||
self._hash_size = hash_size
|
||||
|
||||
Reference in New Issue
Block a user