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

Method __hash_function_2

data_structures/hashing/double_hash.py:27–33  ·  view source on GitHub ↗
(self, value, data)

Source from the content-addressed store, hash-verified

25 super().__init__(*args, **kwargs)
26
27 def __hash_function_2(self, value, data):
28 next_prime_gt = (
29 next_prime(value % self.size_table)
30 if not is_prime(value % self.size_table)
31 else value % self.size_table
32 ) # gt = bigger than
33 return next_prime_gt - (data % next_prime_gt)
34
35 def __hash_double_function(self, key, data, increment):
36 return (increment * self.__hash_function_2(key, data)) % self.size_table

Callers 1

Calls 2

next_primeFunction · 0.85
is_primeFunction · 0.50

Tested by

no test coverage detected