Question:
I wanna know details about doubly linked list?
nitish dolakasharia
2006-11-27 14:33:31 UTC
I know singly linked list
Five answers:
Jackson
2006-11-27 15:03:06 UTC
The only difference is that the Double Linked List contains both a pointer to the next node, similar to a Single Linked List, and it also contains a pointer to the previous node. This allows the client to traverse the list both forward and backwards with little effort.



Say you needed to get to the previous node with a single linked list, you would have to start back at the beginning of the list and walk down to it. Or create another node object in your client application that remembers the previous node. With a Double Linked List it is as simple as hitting rewind. ;-)
rentaprogrammer
2006-11-27 14:42:01 UTC
A doubly linked list is a list wherein the nodes point to the next and previous nodes in the list (thus double or two links versus one for a singly linked list). You would use a doubly linked list if you wanted to traverse the list in both directions. With a singly linked list, you can only traverse from first node to last.



It does add a little complexity to inserting and deleting nodes in the list. You will have another pointer to modify in either case.
DadOnline
2006-11-27 14:38:48 UTC
Here is a link to an article that explains Doubly Linked Lists, as well as other types:
Karen
2016-05-23 19:20:03 UTC
Singly linked list only has a "next pointer" as a data field in the structure or class or container class Double linked list has a next and a previous pointer which uses more memory. In a singly linked list you will often have to start at the beginning of the list to have access to all of instances.
Alex S
2006-11-27 14:43:22 UTC
If you know single linked lists you basically know double

linked ones as well. The difference is just that the double

linked version has a backward pointer as well.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...