# Understanding creation of doubly linked list for Data Structrue in 'C'

Understanding creation of doubly linked list:

One node with information ‘6’ is added to the doubly linked list. Then the list become,

Another node with information ‘16’ is added to the circular linked list. Then the list become,

Similarly when two more nodes are added with information ‘1’ and ’61’, the list become,

Set a pointer variable PTR with ROOT. Process PTR-->INFO and update PTR by LINK of PTR i.e. PTR<--PTR-->LINK. Repeat till the PTR is NULL. The algorithm is as follows:

TRAVERSDLL (ROOT)
PTR<--ROOT
Repeat While PTR< >NULL
Apply process to PTR-->INFO
[End of while]
Exit

Algorithm to print the contents of a linked list:

TRAVERSEDLL (ROOT)
PTR<--ROOT
Repeat While PTR< >NULL
[End of while]
Exit.

From the just created doubly list in the example shown it is possible to traverse the doubly linked list in reverse order starting from the last node. Address of the last node is available in external pointer TEMP. Set a pointer variable PTR with TEMP. Process PTR-->INFO and update PTR by storing the address of previous node given by the pointer part PREV of PTR i.e. PTR<--PTR-->PREV. Repeat till the PTR is NULL.
The algorithm is as follows:

TRAVERSEDLLRO
PTR<--TEMP
Repeat While PTR< >NULL
Apply process to PTR-->INFO; PTR<--PTR-->PREV
[End of while]
Exit.
Rests of the operations are similar to singly linked list and are left out as exercises.

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google