MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / rehashing

Method rehashing

data_structures/hashing/hash_table.py:239–245  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

237 return new_key
238
239 def rehashing(self):
240 survivor_values = [value for value in self.values if value is not None]
241 self.size_table = next_prime(self.size_table, factor=2)
242 self._keys.clear()
243 self.values = [None] * self.size_table # hell's pointers D: don't DRY ;/
244 for value in survivor_values:
245 self.insert_data(value)
246
247 def insert_data(self, data):
248 """

Callers 1

insert_dataMethod · 0.95

Calls 3

insert_dataMethod · 0.95
next_primeFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected