Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions codes/python/chapter_hashing/array_hash_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def hash_func(self, key: int) -> int:
index = key % 100
return index

def get(self, key: int) -> str:
def get(self, key: int) -> str | None:
"""查询操作"""
index: int = self.hash_func(key)
pair: Pair = self.buckets[index]
Expand All @@ -35,7 +35,7 @@ def get(self, key: int) -> str:
return pair.val

def put(self, key: int, val: str):
"""添加操作"""
"""添加和更新操作"""
pair = Pair(key, val)
index: int = self.hash_func(key)
self.buckets[index] = pair
Expand Down
Loading