Double Linked List

Double Linked List
  • Doubly Linked List is second type of Linked list.
  • We can navigate in both ways, either forward and backward.
  • A single linked list node as two parts: Info and Next
  • In double linked list has three parts: Info, Next, and Prev
    • Info − Each node of a linked list can store a data called an element or information.
    • Next − Each node of a linked list contains a link to the next link called Next.
    • Prev − Each node of a linked list contains a link to the previous link called Prev.
  • LinkedList − A Linked List contains the connection link to the first link called First or Head and to the last link called Last or Leaf.
  • Characteristics:
    • The first node has the following properties:
      • Prev - link to be NULL
      • Info - actual value that store in node
      • Next - link to next node
    • The last node has the following properties.
      • Prev - link to prev node
      • Info - actual value that store in node
      • Next - link to be NULL
    • The each node has the following properties.
      • Prev - link to the previous node
      • Info - actual value that store in node
      • Next - link to next node
  • Basic Operations: The following are the basic operations supported by a list.
    • Insertion − 
      • Insert Begin - Adds an element at the beginning of the list.
      • Insert Last − Adds an element at the end of the list.
      • Insert desired position - Add an element as per given position.
    • Deletion − 
      • Delete Begin - Deletes an element at the beginning of the list.
      • Delete Last − Deletes an element from the end of the list.
      • Delete (Key)− Deletes an element from the list using the key.
      • Delete (Position) - Deletes an elements as per given position.
    • Display 
      • Forward − Displays the complete list in a forward manner.
      • Backward − Displays the complete list in a backward manner.
In C, Example: 

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

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form