First time here? Checkout the FAQ!
x
menu search
brightness_auto
more_vert
What is a doubly linked list? Give C representation for the same.
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
 
verified
Best answer

Doubly Linked List is a variation of Linked list in which navigation is

possible in both ways, either forward and backward easily as compared

to Single Linked List.

 

Every nodes in the doubly linked list has three fields: LeftPointer,

RightPointer and Data.

LeftPointer = Left pointer points towards the left node.

RightPointer = Right pointer points towards the right node.

Data = Node which stores the data.

 

The last node has a next link with value NULL, marking the end of the

list, and the first node has a previous link with the value NULL. The

start of the list is marked by the head pointer.

image

C Representation of Doubly Linked List

Structure of doubly link list will contain three fields LeftPointer (prev),

RightPointer (next), and the data as shown below


struct Node {

int data;

struct Node* next;

struct Node* prev;

};

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
...