Small code errors for the LinkedList and HashTable data structures
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- data
Research direction
Search the LinkedList delete() method and the HashTable constructor in the JavaScript source. Check the surrounding implementations and existing tests before making the two corrections described in the issue; done means both data structures use the intended statements without changing other behavior.
Written by the indexing model from the issue text.
Description
Hello!
As I went through the code for these data structures, I noticed two small errors:
-
inside the
delete()method of theLinkedListdata structure, there is a line of code that says:while (this.head && this.compare.equal(this.head.value, value)). However, instead of awhileit should be anifstatement. -
inside the
constructor()of theHashTabledata structure, we initialize an array in the following way:this.buckets = Array(hashTableSize).fill(null).map(() => new LinkedList());. However, theArray()constructor should have thenewkeyword 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.
- Dominant language
- JavaScript
- Stars
- 197k
- Forks
- 31k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from trekhleb/javascript-algorithms
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
trekhleb/javascript-algorithms#2102 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
trekhleb/javascript-algorithms#2085 · 6 comments · 1 reaction ·
-
LinkedList methods. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
trekhleb/javascript-algorithms#2065 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
trekhleb/javascript-algorithms#2057 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
trekhleb/javascript-algorithms#2056 ·
All issues in trekhleb/javascript-algorithms
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
babalae/bettergi-scripts-list#3674 ·
-
ecosystem wording
Difficulty 1/5 Under an hour Newbie friendliness 90/100
matrix-org/matrix.org#3649 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·