difference between double-ended linked lists and doubly-linked list
Asked Answered
E

6

17

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

What is the major difference between the two?

Ellswerth answered 4/2, 2015 at 19:24 Comment(0)
S
21

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.)

Salute answered 4/2, 2015 at 19:48 Comment(2)
thanks guys, any other differences will be appreciatedEllswerth
There are no other essential differences.Salute
A
5

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.

Andersen answered 27/12, 2018 at 5:29 Comment(0)
S
3

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.

Straw answered 4/2, 2015 at 19:37 Comment(0)
E
2

Single linked it's one way direction and it uses less memory and the complexity of insertion is O(n). While the double linked is a two way direction (next and previous), it uses more memory than the single list and the complexity of insertion and deletion is O(n).

Earldom answered 10/5, 2016 at 9:51 Comment(0)
B
1

Because it only contains the next node reference in the node, a double-ended linked list resembles a singly Linked list more. It differs from a singly list, though, because the list contains pointers for both the first and last nodes. Additionally, new nodes can be added from both ends.

Nodes in a doubly linked list contain references to both the next and the previous node.

doubly linked list :

  • node contain references of next and previous node.
  • Can go back and forth in the linked list.

double-ended linked list:

  • node contain references of next node.
  • Have two pointers for first and the last node.
  • Can't go back and forth in the list.
Biparty answered 6/3, 2023 at 1:42 Comment(0)
S
0

In both lists, there are two pointers from front and end. But the Double-ended list can't move backward, only to forward while the Doubly Linked list can move both forward & backward.

Stretcherbearer answered 19/8, 2021 at 9:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.