mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-15 00:26:05 +00:00
Update hash map
This commit is contained in:
@@ -49,7 +49,7 @@ func (a *ArrayHashMap) put(key int, val string) {
|
||||
/* 删除操作 */
|
||||
func (a *ArrayHashMap) remove(key int) {
|
||||
index := a.hashFunc(key)
|
||||
// 置为空字符,代表删除
|
||||
// 置为 nil ,代表删除
|
||||
a.bucket[index] = nil
|
||||
}
|
||||
|
||||
@@ -93,4 +93,4 @@ func (a *ArrayHashMap) print() {
|
||||
fmt.Println(pair.key, "->", pair.val)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user