MCPcopy
hub / github.com/keon/algorithms / hash

Method hash

algorithms/data_structures/hash_table.py:110–119  ·  view source on GitHub ↗

Compute the hash index for a key. Args: key: The key to hash. Returns: Index into the internal array.

(self, key: int)

Source from the content-addressed store, hash-verified

108 return None
109
110 def hash(self, key: int) -> int:
111 """Compute the hash index for a key.
112
113 Args:
114 key: The key to hash.
115
116 Returns:
117 Index into the internal array.
118 """
119 return key % self.size
120
121 def _rehash(self, old_hash: int) -> int:
122 """Linear probing rehash.

Callers 3

putMethod · 0.95
getMethod · 0.95
del_Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected