What do you mean by double linked list? Explain with example.

Answers

This answer is not selected as best answer. This answer may not be sufficient for exam.

Your limit has been exceed. We have implemented this system because, We got difficulty on managing our servers. Please donate some amount to remove this limit.

Quota: 0 / 30

Donate

Doubly linked list is a sequence of elements in which every element has links to its previous element and next element in the sequence.

In double linked list, every node has link to its previous node and next node. So, we can traverse forward by using next field and can traverse backward by using previous field. Every node in a double linked list contains three fields and they are shown in the following figure…

User Loaded Image | CSIT Guide

Here, ‘link1’ field is used to store the address of the previous node in the sequence, ‘link2’ field is used to store the address of the next node in the sequence and ‘data’ field is used to store the actual value of that node.

Example:

User Loaded Image | CSIT Guide

  • In double linked list, the first node must be always pointed by head.
  • Always the previous field of the first node must be NULL.
  • Always the next field of the last node must be NULL

Representation of doubly linked list

struct node
{
   int info;
   struct node *prev;
   struct node *next;
};

typedef struct node NodeType;

NodeType *head=NULL:
If you found any type of error on the answer then please mention on the comment or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .