Double Linked vs. Single Linked lists

Posted by Nick Cash on Fri 29 Jul 2005 10:59 PM — 4 posts, 27,563 views.

USA #0
I was wondering for a while now. I always use doubly linked lists when I need a linked lists. This is probably habbit from programming on my mud for so long, but I'm not really sure what the bennefit is.

A friend of mine dislikes keeping track of the last object within a list. So he tends to use singely linked lists.

Can anyone tell me the advantage of a doublely linked list compared to a singely linked list? I've never really had a reason to parse the list backwards.
Australia Forum Administrator #1
Simply to be bidirectional. You have slightly more storage needed (a forwards and backwards link) plus slightly more work to do when adding/deleting items.
USA #2
Doubly-linked lists also make it easier to remove things from the list. If you're stepping through a singly-linked list and want to remove something, you have to keep track of the previous element. Not hard, but it's something you have to do.

You also don't have to keep track of the last object in a doubly-linked list, unless your list is circular.

In any case, a doubly-linked list has four extra bytes of overhead per element when compared to a singly-linked list. This is significant for lists of characters (i.e. char) but negligible for lists of game-characters (i.e. char_data).
#3
In my view DLL are very flexible in adding & removing elements.
in Data storage we create the index for easy retrive & insert & delete records.
Nowadays Datawarehousing is one of the interesting topic. in DBMS fast retreving of data is important. for this, Binary search is more advantageous. pointer points to any record, move easily to any direction, so that we get record in less amount of time.
There is lot of secondary memory or disk space available. so do't bother about wastage of memory. thanq.