You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I went through the code for these data structures, I noticed two small errors:
inside the delete() method of the LinkedList data structure, there is a line of code that says: while (this.head && this.compare.equal(this.head.value, value)). However, instead of a while it should be an if statement.
inside the constructor() of the HashTable data structure, we initialize an array in the following way: this.buckets = Array(hashTableSize).fill(null).map(() => new LinkedList());. However, the Array() constructor should have the new keyword in front of it.
If you guys feel that these are important fixes to you and if you allow me to help, I would be more than glad to contribute by creating a pull request with the changes made.
The text was updated successfully, but these errors were encountered:
For the LinkedList data structure, you're correct that the while statement should be replaced with an if statement. Here's the corrected delete method:
Hello!
As I went through the code for these data structures, I noticed two small errors:
inside the
delete()
method of theLinkedList
data structure, there is a line of code that says:while (this.head && this.compare.equal(this.head.value, value))
. However, instead of awhile
it should be anif
statement.inside the
constructor()
of theHashTable
data structure, we initialize an array in the following way:this.buckets = Array(hashTableSize).fill(null).map(() => new LinkedList());
. However, theArray()
constructor should have thenew
keyword in front of it.If you guys feel that these are important fixes to you and if you allow me to help, I would be more than glad to contribute by creating a pull request with the changes made.
The text was updated successfully, but these errors were encountered: