Insert or update, resizing if load factor exceeds two-thirds. Args: key: The key to insert. value: The value associated with the key.
(self, key: int, value: object)
| 158 | super().__init__(self.MIN_SIZE) |
| 159 | |
| 160 | def put(self, key: int, value: object) -> None: |
| 161 | """Insert or update, resizing if load factor exceeds two-thirds. |
| 162 | |
| 163 | Args: |
| 164 | key: The key to insert. |
| 165 | value: The value associated with the key. |
| 166 | """ |
| 167 | super().put(key, value) |
| 168 | if len(self) >= (self.size * 2) / 3: |
| 169 | self._resize() |
| 170 | |
| 171 | def _resize(self) -> None: |
| 172 | """Double the table size and rehash all existing entries.""" |