trekhleb / trekhleb/javascript-algorithms
Two way binding
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 197k
- Forks
- 31k
- PR merge metrics
- No merged PRs in 30d
Description
If I think about doubly linked list I mean two way binding. Something like this:
node2.next === node3
node2.previous === node1
And then:
class DoublyLinkedList {
constructor(value, prev = null) {
this.value = value;
this.prev = prev;
this.next = null;
if (prev !== null) prev.next = this;
}
}
Or i'm wrong?
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.
Research direction
Start with the linked assertions in src/data-structures/doubly-linked-list/test/DoublyLinkedListNode.test.js around lines 29–30, then inspect the doubly-linked-list implementation. Verify whether adjacent nodes expose the expected two-way links shown in the issue, and update the behavior and tests so the intended relationship is explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100