mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-16 13:40:58 +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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,3 @@ func TestArrayHashMap(t *testing.T) {
|
||||
fmt.Println(val)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user