Saturday, March 5, 2011

DS- doubly linked list (page 2)

Doubly-Linked Lists — linked lists containing integer values or pointers to data, with the ability to iterate over the list in both directions.

Each element in the list contains a piece of data, together with pointers which link to the previous and next elements in the list. Using these pointers it is possible to move through the list in both directions (unlike the Singly-Linked Lists which only allows movement through the list in the forward direction).

The data contained in each element can be either integer values, by using one of the Type Conversion Macros, or simply pointers to any type of data.

While adding or removing a node in a doubly-linked list requires changing more links than the same operations on a singly-linked list, the operations are simpler and potentially more efficient (for nodes other than first nodes) because there is no need to keep track of the the previous node during traversal or no need to traverse the list to find the previous node, so that its link can be modified.

refer : http://en.wikipedia.org/wiki/Doubly-linked_list
          http://library.gnome.org/devel/glib/unstable/glib-Doubly-Linked-Lists.html

No comments:

Post a Comment