Doubly Link List is data structure which contains list of node having info part and pointer to previous and next node of the list. This makes traversal easy. The last node's next and first node's prev pointer points to nothing. Before going to discuss the operation on doubly link list, we will first see the basic structure of the data type and see how it could be represented in c programming. First we will see the how the node of doubly link list is represented. See the image below:
The component of singly list node:
The component of doubly list are:
Now we see the different operation that can be performed on the doubly link list:
The component of singly list node:
- info : It contains the actual information
- next : This field points to the next node in the list
- prev : This field points to the previous node in the list
The component of doubly list are:
- START pointer points to the first node of the list
- NODE : Each node have info field, next pointer to point next NODE in the list and prev pointer to point previous node in the list
- prev of first node and next of last node will points to NULL
struct node{
int info;
struct node *next, *prev;
};
typedef struct node NODE;
Now we see the different operation that can be performed on the doubly link list:
Comments
Post a Comment