by Dinesh Thakur Category: Linked Lists

A more sophisticated kind of linked list is a doubly-linked list or a two-way linked list. In a doubly linked list, each node has two links: one pointing to the previous node and one pointing to the next node.


Node structure

 Node Structure

Implementation of a doubly linked list


Adding an element to the list


To add the first node


first_node->next = NULL;

first_node->data = input_element;

first_node->prev = NULL;


To add a node at the position specified


Temp_node = *first_node;

for ( counter = 0 ; counter<position-1 ; counter++ )


Temp_node = Temp_node->next;


new_node->next = temp_node->next;


new_node->prev = temp_node->next->prev;

temp_node->next->prev = new_node;


Deleting a particular element from the list


Temp_node = *first_node;

If ( temp_node->data = = input_element )

First_node = first_node->next;



while ( temp_node != NULL && temp_node->next->data !=


temp_node = temp_node -> next;







About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Search Content