Several bug fixes.

This commit is contained in:
krahets
2023-09-24 20:38:21 +08:00
parent e3773b7f76
commit ff8e7ceec5
19 changed files with 19 additions and 19 deletions

View File

@@ -17,7 +17,7 @@ class HashMapChaining {
public:
/* 构造方法 */
HashMapChaining() : size(0), capacity(4), loadThres(2.0 / 3), extendRatio(2) {
HashMapChaining() : size(0), capacity(4), loadThres(2.0 / 3.0), extendRatio(2) {
buckets.resize(capacity);
}

View File

@@ -11,7 +11,7 @@ class HashMapOpenAddressing {
private:
int size; // 键值对数量
int capacity = 4; // 哈希表容量
const double loadThres = 2.0 / 3; // 触发扩容的负载因子阈值
const double loadThres = 2.0 / 3.0; // 触发扩容的负载因子阈值
const int extendRatio = 2; // 扩容倍数
vector<Pair *> buckets; // 桶数组
Pair *TOMBSTONE = new Pair(-1, "-1"); // 删除标记