Update hash map

This commit is contained in:
Yudong Jin
2022-12-15 23:08:07 +08:00
parent 1229f98e92
commit c071ab88d2
6 changed files with 13 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ public:
/* 删除操作 */
void remove(int key) {
int index = hashFunc(key);
// 置为空字符,代表删除
// 置为 nullptr ,代表删除
bucket[index] = nullptr;
}
@@ -97,6 +97,8 @@ public:
}
}
};
/* Driver Code */
int main() {
/* 初始化哈希表 */
ArrayHashMap map = ArrayHashMap();
@@ -139,4 +141,4 @@ int main() {
}
return 0;
}
}