linked-list definition of "head" and "tail"
See original GitHub issuethe notion of “head” and “tail” seem to be backwards in the example.js
.
I’d expect “back” to correspond to “tail” and “front” to correspond to “head”, like this article.
the example works and tests, but it seems conceptually misleading, imo.
README:
push
(insert value at back);
example.js:
push(value) {
if (this.head) {
const newHead = new Element(value);
newHead.next = this.head;
this.head.prev = newHead;
this.head = newHead;
} else {
this.head = new Element(value);
this.tail = this.head;
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Linked List Data Structure - Java Vault - Medium
The first Node in the List is called head and its pointer for the previous Node points to null. The last Node in...
Read more >Types of Linked List in Data Structures - InterviewBit
The Head pointer keeps track of the starting node of the linked list. And the Tail pointer point to the end of the...
Read more >make a linked list with head and tail nodes - Stack Overflow
Head does not link to tail. You should think of them as separate items. Head points to the start of the list and...
Read more >Tutorials for SBME Students
The tail of a list can be found by traversing the linked list— starting at the head and moving from one node to...
Read more >Data Structures: Linked List | Jinjun's Notes
The data is stored in nodes, which are connected to each other. The first node is called the head and the last node...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Changes in PR look good. But the README description is confusing (maybe because it is a doubly linked list) - I would generally expect to instead and remove from head only (aka stack). But anyways the problem specification also says the same - so seems good.
ok. PR from a fork?