Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between double-ended linked lists and doubly-linked list

I don't understand difference between a double-ended and doubly-linked list.

What is the major difference between the two?

like image 555
pycod333 Avatar asked Feb 04 '15 19:02

pycod333


3 Answers

In a doubly linked list, each node has two pointers. One towards its next node and another one towards its previous node.

enter image description here

In a double-ended linked list, each node has just one pointer which points to its next node. Its difference from the single-ended linked list is that instead of just one "head" node, it contains two pointers of this kind ("first" and "last"), so someone is able to insert elements to list from both ends of it.

enter image description here

(Last picture isn't that clear, but it catches the point of the two ends.)

like image 193
Kapoios Avatar answered Sep 28 '22 04:09

Kapoios


A double ended list is similar to an ordinary linked list, but it has one additional features: a reference to the last link as well as to the first. In a doubly linked list each link has two references to other links instead of one. The first is to the next link, as in ordinary lists. The second is to the previous link.

like image 39
Sanduni Mabarana Avatar answered Sep 28 '22 04:09

Sanduni Mabarana


A doubly linked list is a list where the elements have pointers to both the element before and after in the list.

A double ended list is from my understanding the same as a deque. That is a queue from which you can add and remove items from both the top and the bottom.

like image 27
Einar Sundgren Avatar answered Sep 28 '22 03:09

Einar Sundgren