diff --git a/data_structures/hashing/double_hash.py b/data_structures/hashing/double_hash.py index 6c3699cc9..ce4454db0 100644 --- a/data_structures/hashing/double_hash.py +++ b/data_structures/hashing/double_hash.py @@ -24,7 +24,7 @@ class DoubleHash(HashTable): def __hash_double_function(self, key, data, increment): return (increment * self.__hash_function_2(key, data)) % self.size_table - def _colision_resolution(self, key, data=None): + def _collision_resolution(self, key, data=None): i = 1 new_key = self.hash_function(data) diff --git a/data_structures/hashing/hash_table.py b/data_structures/hashing/hash_table.py index 988f2ba0d..3b39742f9 100644 --- a/data_structures/hashing/hash_table.py +++ b/data_structures/hashing/hash_table.py @@ -62,7 +62,8 @@ class HashTable: self.size_table = next_prime(self.size_table, factor=2) self._keys.clear() self.values = [None] * self.size_table # hell's pointers D: don't DRY ;/ - map(self.insert_data, survivor_values) + for value in survivor_values: + self.insert_data(value) def insert_data(self, data): key = self.hash_function(data) diff --git a/data_structures/hashing/hash_table_with_linked_list.py b/data_structures/hashing/hash_table_with_linked_list.py index 236985b69..48d93bbc5 100644 --- a/data_structures/hashing/hash_table_with_linked_list.py +++ b/data_structures/hashing/hash_table_with_linked_list.py @@ -18,9 +18,9 @@ class HashTableWithLinkedList(HashTable): * self.charge_factor ) - def _colision_resolution(self, key, data=None): + def _collision_resolution(self, key, data=None): if not ( len(self.values[key]) == self.charge_factor and self.values.count(None) == 0 ): return key - return super()._colision_resolution(key, data) + return super()._collision_resolution(key, data) diff --git a/data_structures/hashing/quadratic_probing.py b/data_structures/hashing/quadratic_probing.py index ac966e1cd..0dd84a5d9 100644 --- a/data_structures/hashing/quadratic_probing.py +++ b/data_structures/hashing/quadratic_probing.py @@ -11,7 +11,7 @@ class QuadraticProbing(HashTable): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - def _colision_resolution(self, key, data=None): + def _collision_resolution(self, key, data=None): i = 1 new_key = self.hash_function(key + i * i)