Add JavaScript and TypeScript code of top_k and update some code style (#686)

* Update JS and TS code style

* Add JavaScript and TypeScript code of top_k

* Update top_k.ts

* Apply suggestions from code review

Co-authored-by: Justin Tse <xiefahit@gmail.com>

* Apply suggestions from code review

Co-authored-by: Justin Tse <xiefahit@gmail.com>

---------

Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
Justin Tse
2023-08-17 05:00:35 +08:00
committed by GitHub
parent 4c75c204f3
commit 5d7e0a59b1
11 changed files with 94 additions and 9 deletions

View File

@ -82,7 +82,7 @@ class HashMapChaining {
for (let i = 0; i < bucket.length; i++) {
if (bucket[i].key === key) {
bucket.splice(i, 1);
this.size--;
this.#size--;
break;
}
}