FAQ: Doubly Linked Lists: Conceptual - Doubly Linked Lists Introduction

This community-built FAQ covers the “Doubly Linked Lists Introduction” exercise from the lesson “Doubly Linked Lists: Conceptual”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Pass the Technical Interview with JavaScript

FAQs on the exercise Doubly Linked Lists Introduction

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hello there.
I have some question about this concept lesson.
in this lesson it says,

Due to the extra pointer and tail property, removing the head from a doubly linked list is slightly more complicated than removing the head from a singly linked list. However, the previous pointer and tail property make it much simpler to remove the tail of the list, as we don’t have to traverse the entire list to be able to do it.

here I don’t understand why ‘tail property’ make removing the head from a doubly linked list? since removing head will just gonna affect on the front line of the list not the tail side?

let’s say we have we have 10 nodes in our list
and when we trying to to 2 actions

  1. removing the head from the list
  2. removing the tail from the list.

1 might need to focus on the 2nd node,
which means that i need to change 2nd node’s prev node to null
and change its next node as it was.

that’s all
i think i don’t need to consider about tail node.
is there any misunderstanding in my explanation?

please anyone teach me… haha thank you !

I think you are correct. I think the tail node wouldn’t affect the head deletion/insertion in normal doubly linked list.

One interesting idea is having a ‘circular’ doubly-linked list, where tail.next == head and head.prev == tail. In other words, once you get to the tail, you loop back around to the head, and vice versa. In this case, if you were to remove the head from the list (action 1), one might change the tail node’s properties as well as the 2nd node’s properties.

i.e.
making both the

  • tail.next = head.next; // leaving out the head node from the circular doubly-linked list
  • head.next.prev = tail; // " "

then removing head’s links

  • head.next = null;
  • head.prev = null;

then making head point to the new head

  • head = tail.next; // the new head

// or something similar

Source 1 is a picture of a circular doubly-linked list:

(source 1: Joshua Hannan, Circular Linked List in Solidity! | by Joshua Hannan | Modular-Network | Medium )
(source 2, linear doubly linked lists: Computer science in JavaScript: Doubly linked lists - Human Who Codes )

*I’m not too familiar with this lesson but hope this helps!