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 () 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 () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
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
removing the head from the list
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?
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: