This commit is contained in:
tmichell13 2024-07-17 10:43:02 +09:00 committed by GitHub
commit 4a1c8e51d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ export default class HashTable {
*/ */
constructor(hashTableSize = defaultHashTableSize) { constructor(hashTableSize = defaultHashTableSize) {
// Create hash table of certain size and fill each bucket with empty linked list. // Create hash table of certain size and fill each bucket with empty linked list.
this.buckets = Array(hashTableSize).fill(null).map(() => new LinkedList()); this.buckets = new Array(hashTableSize).fill(null).map(() => new LinkedList());
// Just to keep track of all actual keys in a fast way. // Just to keep track of all actual keys in a fast way.
this.keys = {}; this.keys = {};

View File

@ -101,7 +101,7 @@ export default class LinkedList {
// If the head must be deleted then make next node that is different // If the head must be deleted then make next node that is different
// from the head to be a new head. // from the head to be a new head.
while (this.head && this.compare.equal(this.head.value, value)) { if (this.head && this.compare.equal(this.head.value, value)) {
deletedNode = this.head; deletedNode = this.head;
this.head = this.head.next; this.head = this.head.next;
} }