DEV Community 👩‍💻👨‍💻

Cover image for Doubly Linked List Data Structure and operations

Posted on

Doubly Linked List Data Structure and operations

Alt Text

A Doubly Linked List Data Structure will have nodes that have:

  1. Data
  2. Address which points to the next node
  3. Address which points to the previous node

So navigation is possible both ways (forwards and backwards).


Operation Name Operations
Insertion Insertion at the start,end and after a particular node
Deletion Deletion at the start,end and of a particular node
Traversing Going through each node and performing some action
Searching Comparing each data node with some item being searched for
Reverse Reverse the entire list
Update Modify a data node with a given value

Implementation in C++

We know that each node in a doubly linked list (DLL) has 3 parts:

  1. Data
  2. previous pointer
  3. next pointer

So let's code the basic structure/blueprint of a DLL

#include <iostream>
using namespace std;

//declare a structure data called Node
struct Node { 
//declare integer data type called data
   int data; 
//declare the previous & next pointer of the *Node* structure data type
   struct Node *prev; 
   struct Node *next; 

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Update Your DEV Experience Level:


Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠