Skip to content
Programming101
Programmingoneonone

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programmingoneonone

Learn everything about programming

Deletion in Doubly Linked List

YASH PAL, 20 May 202028 May 2024

In this tutorial, we are going to learn how to perform deletion operations in the doubly linked list.

after completing this tutorial you are able to learn how to

  1. Delete the first node.
  2. Delete the only node.
  3. Delete a node in between the nodes.
  4. Delete the last node.

Deletion of the first node from the doubly-linked list

as you see we have a doubly-linked list that has four nodes. so after deleting the first node second node become the first node.

deletion in doubly linked list in data structures

so first we store the second node’s reference to the start variable.

deletion in doubly linked list in data structures

and then we set the second node’s previous link part to Null or None. because the previous link part of the first node in the doubly linked list is always None or Null.

deletion in doubly linked list in data structures

so after performing these steps, the first node is deleted.

deletion in doubly linked list in data structures

Delete the only node from the doubly linked list.

if a linked list has only one node then to delete this node we set the start variable to the None.

deletion in doubly linked list in data structures
deletion in doubly linked list in data structures

so now our list becomes an empty list.

Delete a node in between the nodes.

to delete a node between two nodes first we need to find out the reference to the node that we want to delete. as you see to delete the third node first we found a reference p to that node.

deletion in doubly linked list in data structures

and then we store the reference of the node that comes after node p into the next link part of the node that comes before node p.

deletion in doubly linked list in data structures

and then we store the reference of the node that comes before node p into the previous link part of the node that comes after node p.

deletion in doubly linked list in data structures

now after performing these steps now, the third node has been deleted from the doubly linked list.

deletion in doubly linked list in data structures

Delete the last node from the doubly linked list

to delete the last node of the list first we need to find out the reference of the last node.

deletion in doubly linked list in data structures

and then we set the next link part of the node to Null or None that come before node p.

deletion in doubly linked list in data structures

so after performing these steps now the last node of the list is deleted.

deletion in doubly linked list in data structures
Computer Science Tutorials Data Structures Tutorials computer scienceData Structure

Post navigation

Previous post
Next post
  • Automating Image Format Conversion with Python: A Complete Guide
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
How to download udemy paid courses for free

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes