English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I know singly linked list

2006-11-27 09:33:31 · 5 answers · asked by nitish dolakasharia 1 in Computers & Internet Programming & Design

5 answers

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

2006-11-27 10:03:06 · answer #1 · answered by Jackson 2 · 0 0

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.

2006-11-27 09:42:01 · answer #2 · answered by rentaprogrammer 2 · 0 0

Here is a link to an article that explains Doubly Linked Lists, as well as other types:

2006-11-27 09:38:48 · answer #3 · answered by DadOnline 6 · 0 0

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.

2016-05-23 15:20:03 · answer #4 · answered by Karen 4 · 0 0

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.

2006-11-27 09:43:22 · answer #5 · answered by Alex S 5 · 0 0

fedest.com, questions and answers