mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
Several bug fixes.
This commit is contained in:
@ -18,7 +18,7 @@ class HashMapChaining {
|
||||
public HashMapChaining() {
|
||||
size = 0;
|
||||
capacity = 4;
|
||||
loadThres = 2 / 3.0;
|
||||
loadThres = 2.0 / 3.0;
|
||||
extendRatio = 2;
|
||||
buckets = new List<List<Pair>>(capacity);
|
||||
for (int i = 0; i < capacity; i++) {
|
||||
|
||||
@ -10,7 +10,7 @@ namespace hello_algo.chapter_hashing;
|
||||
class HashMapOpenAddressing {
|
||||
private int size; // 键值对数量
|
||||
private int capacity = 4; // 哈希表容量
|
||||
private double loadThres = 2.0 / 3; // 触发扩容的负载因子阈值
|
||||
private double loadThres = 2.0 / 3.0; // 触发扩容的负载因子阈值
|
||||
private int extendRatio = 2; // 扩容倍数
|
||||
private Pair[] buckets; // 桶数组
|
||||
private Pair TOMBSTONE = new Pair(-1, "-1"); // 删除标记
|
||||
|
||||
Reference in New Issue
Block a user