question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

linked-list definition of "head" and "tail"

See original GitHub issue

the 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:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tejasbubanecommented, Mar 5, 2019

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.

1reaction
mp0wrcommented, Mar 4, 2019

ok. PR from a fork?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found