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

Method __init__

data_structures/hashing/hash_map.py:41–48  ·  view source on GitHub ↗
(
        self, initial_block_size: int = 8, capacity_factor: float = 0.75
    )

Source from the content-addressed store, hash-verified

39 """
40
41 def __init__(
42 self, initial_block_size: int = 8, capacity_factor: float = 0.75
43 ) -> None:
44 self._initial_block_size = initial_block_size
45 self._buckets: list[_Item | None] = [None] * initial_block_size
46 assert 0.0 < capacity_factor < 1.0
47 self._capacity_factor = capacity_factor
48 self._len = 0
49
50 def _get_bucket_index(self, key: KEY) -> int:
51 return hash(key) % len(self._buckets)

Callers 1

__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected