This commit is contained in:
krahets 2023-10-10 22:59:09 +08:00
parent bf7c9999b2
commit 1cafc95562
2 changed files with 5 additions and 5 deletions

View File

@ -2174,7 +2174,7 @@ comments: true
// 若遇到指定 key ,则返回对应 val // 若遇到指定 key ,则返回对应 val
if ( if (
this.#buckets[j].key === key && this.#buckets[j].key === key &&
this.#buckets[j][key] !== this.#removed.key this.#buckets[j].key !== this.#removed.key
) )
return this.#buckets[j].val; return this.#buckets[j].val;
} }
@ -2195,7 +2195,7 @@ comments: true
// 若遇到空桶、或带有删除标记的桶,则将键值对放入该桶 // 若遇到空桶、或带有删除标记的桶,则将键值对放入该桶
if ( if (
this.#buckets[j] === null || this.#buckets[j] === null ||
this.#buckets[j][key] === this.#removed.key this.#buckets[j].key === this.#removed.key
) { ) {
this.#buckets[j] = new Pair(key, val); this.#buckets[j] = new Pair(key, val);
this.#size += 1; this.#size += 1;
@ -2302,7 +2302,7 @@ comments: true
// 若遇到指定 key ,则返回对应 val // 若遇到指定 key ,则返回对应 val
if ( if (
this.#buckets[j].key === key && this.#buckets[j].key === key &&
this.#buckets[j][key] !== this.#removed.key this.#buckets[j].key !== this.#removed.key
) )
return this.#buckets[j].val; return this.#buckets[j].val;
} }
@ -2323,7 +2323,7 @@ comments: true
// 若遇到空桶、或带有删除标记的桶,则将键值对放入该桶 // 若遇到空桶、或带有删除标记的桶,则将键值对放入该桶
if ( if (
this.#buckets[j] === null || this.#buckets[j] === null ||
this.#buckets[j][key] === this.#removed.key this.#buckets[j].key === this.#removed.key
) { ) {
this.#buckets[j] = new Pair(key, val); this.#buckets[j] = new Pair(key, val);
this.#size += 1; this.#size += 1;

View File

@ -22,7 +22,7 @@ hide:
</a> </a>
&nbsp; &nbsp;
<a href="https://github.com/krahets/hello-algo"> <a href="https://github.com/krahets/hello-algo">
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/krahets/hello-algo?style=social&logo=handshake&logoColor=%23101010"> <img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/krahets/hello-algo?style=social&logo=git&logoColor=%23101010">
</a> </a>
</p> </p>