← All Topics

Doubly Linked Lists — Simple English

57 lessons · Data Structures & Algorithms · Simple English · Beginner Friendly

🔒Premium course. The first 3 lessons are free — subscribe to unlock the rest (one plan unlocks every premium course).View plans
01 Why Singly Linked Lists Fall Short: The Problem That Leads to Doubly Linked ListsFree Why Singly Linked Lists Fall Short A singly linked list is a chain of boxes called nodes. Each node holds some data and … 02 The Doubly Linked List: A Two-Way ChainFree The Doubly Linked List: A Two-Way Chain A regular (singly) linked list is a chain of boxes, where each box only knows ab… 03 Defining a Node in a Doubly Linked ListFree Defining a Node in a Doubly Linked List A node is the basic building block of a doubly linked list. Think of it like a s… 04 Structure of a Doubly Linked List🔒 Structure of a Doubly Linked List A doubly linked list, just like a singly linked list, is a chain of nodes. A node is o… 05 Operations on a Doubly Linked List: Traversal, Insertion, and Deletion🔒 Operations on a Doubly Linked List By now you know what a single node of a doubly linked list looks like, and how severa… 06 Traversing a Doubly Linked List: Going Forward and Backward🔒 Traversing a Doubly Linked List Traversal simply means visiting the nodes of a list one by one, in order, so you can loo… 07 Walking Through a Doubly Linked List: Printing Every Value🔒 Walking Through a Doubly Linked List Before we solve this problem, let's understand the kind of list we are working with… 08 Printing a Doubly Linked List Backwards from the Tail🔒 Printing a Doubly Linked List from End to Start A doubly linked list is a chain of boxes called nodes. Each node holds a… 09 Searching for a Node in a Doubly Linked List🔒 Searching for a Node in a Doubly Linked List Imagine a train made of connected coaches. Each coach holds some cargo, and… 10 Inserting a Node at the Beginning of a Doubly Linked List🔒 Inserting a Node at the Beginning of a Doubly Linked List A doubly linked list is a chain of boxes called nodes. Each no… 11 Inserting a New Node at the Beginning of a Doubly Linked List🔒 Inserting a New Node at the Beginning of a Doubly Linked List A doubly linked list is a chain of boxes called nodes. Eac… 12 Inserting a New Node at the End of a Doubly Linked List🔒 Inserting a New Node at the End of a Doubly Linked List A doubly linked list is a chain of boxes called nodes. Each node… 13 Inserting a New Node at the End of a Doubly Linked List🔒 Inserting a New Node at the End of a Doubly Linked List A doubly linked list is a chain of boxes called nodes. Each node… 14 Inserting a Node After a Given Node in a Doubly Linked List🔒 Inserting a Node After a Given Node in a Doubly Linked List In a doubly linked list, every node holds three things: a va… 15 Inserting a New Node After a Given Node in a Doubly Linked List🔒 Inserting a New Node After a Given Node A doubly linked list is a chain of small boxes called nodes. Each node holds thr… 16 Inserting a New Node Before a Given Node in a Doubly Linked List🔒 Inserting a New Node Before a Given Node A doubly linked list is a chain of boxes called nodes. Each node holds three th… 17 Inserting a New Node Before a Given Node in a Doubly Linked List🔒 Inserting a New Node Before a Given Node A doubly linked list is a chain of boxes. Each box is called a node. Every node… 18 Inserting a Node at a Given Distance in a Doubly Linked List🔒 Inserting a Node at a Given Position in a Doubly Linked List Sometimes you don't want to add a new node at the very star… 19 Inserting a Node at a Given Distance in a Doubly Linked List🔒 Inserting a Node at a Given Distance A doubly linked list is a chain of boxes. Each box is called a node. Every node hol… 20 Deleting the First Node of a Doubly Linked List🔒 Deleting the First Node of a Doubly Linked List Removing the very first node from a doubly linked list is one of the eas… 21 Deleting the First Node of a Doubly Linked List🔒 Deleting the First Node of a Doubly Linked List A doubly linked list is a chain of boxes. Each box is called a node. Eve… 22 Deleting the Last Node of a Doubly Linked List🔒 Deleting the Last Node of a Doubly Linked List A doubly linked list is a chain of boxes, where each box is called a node… 23 Deleting the Last Node of a Doubly Linked List🔒 Deleting the Last Node of a Doubly Linked List A doubly linked list is a chain of boxes called nodes. Each node holds th… 24 Deleting a Node by Its Data in a Doubly Linked List🔒 Deleting a Node by Its Data in a Doubly Linked List Sometimes you don't know where a value sits in your list — you just … 25 Deleting a Node with a Given Value from a Doubly Linked List🔒 Deleting a Node with a Given Value A doubly linked list is a chain of boxes. Each box is called a node. Every node holds… 26 Deleting All Nodes With a Given Value From a Doubly Linked List🔒 Deleting All Nodes With a Given Value From a Doubly Linked List Imagine a chain of boxes laid out in a line. Each box ho… 27 Deleting the Node After a Given Node in a Doubly Linked List🔒 Deleting the Node After a Given Node in a Doubly Linked List Imagine a line of people, where each person holds the hand … 28 Deleting the Node After a Given Node in a Doubly Linked List🔒 Deleting the Node After a Given Node A doubly linked list is a chain of boxes called nodes. Each node holds three things… 29 Deleting the Node Before a Given Node in a Doubly Linked List🔒 Deleting the Node Before a Given Node Sometimes you have a pointer to one node in a list, and you want to remove the nod… 30 Deleting the Node That Comes Before a Given Node in a Doubly Linked List🔒 Deleting the Node Before a Given Node In a doubly linked list, every node knows about two of its neighbors. It holds a p… 31 Deleting a Given Node in a Doubly Linked List🔒 Deleting a Given Node in a Doubly Linked List Sometimes you are not asked to delete a node by searching for a value. Ins… 32 Deleting a Given Node from a Doubly Linked List🔒 Deleting a Given Node from a Doubly Linked List Imagine a row of train cars where each car is connected to the car in fr… 33 Deleting a Node at a Given Distance in a Doubly Linked List🔒 Deleting a Node at a Given Distance in a Doubly Linked List Imagine a doubly linked list as a row of train cars. Each ca… 34 Deleting a Node at a Given Distance in a Doubly Linked List🔒 Deleting a Node at a Given Distance in a Doubly Linked List A doubly linked list is a chain of boxes called nodes. Each … 35 Understanding the Reversal Pattern🔒 Understanding the Reversal Pattern Imagine a line of train coaches connected one after another. Each coach is hooked to … 36 Reversing a Doubly Linked List In Place🔒 Reversing a Doubly Linked List A doubly linked list is a chain of boxes called nodes. Each node holds a value and has tw… 37 Reverse the First K Nodes of a Doubly Linked List🔒 Reverse the First K Nodes of a Doubly Linked List Imagine a line of people holding hands, where each person can see the … 38 Reversing the Last K Nodes of a Doubly Linked List🔒 Reversing the Last K Nodes of a Doubly Linked List Imagine a train where every coach is connected to the coach in front … 39 Reversing a Part of a Doubly Linked List🔒 Reversing a Part of a Doubly Linked List Imagine a row of train cars connected to each other. In a doubly linked list, e… 40 Spotting the Reversal Subproblem Pattern: Reversing a Doubly Linked List in Groups of K🔒 When a Big Problem Hides Many Small Reversals Some problems look hard at first, but they are really just a few smaller p… 41 Pairwise Swap of Nodes in a Doubly Linked List🔒 Pairwise Swap in a Doubly Linked List Imagine a line of people holding hands, where each person can see both the person … 42 Reversing a Doubly Linked List in Groups of K🔒 Reversing a Doubly Linked List in Groups of K Imagine a line of people holding hands, where each person can see the pers… 43 Reverse a Doubly Linked List in Groups of Increasing Size🔒 Reverse a Doubly Linked List in Groups of Growing Size Imagine a line of people holding hands, where each person can see… 44 Reverse Alternate Segments of a Doubly Linked List🔒 Reverse Alternate Segments of a Doubly Linked List Imagine a line of people holding hands, where each person can see bot… 45 The Two-Pointer Pattern in a Doubly Linked List🔒 The Two-Pointer Pattern Why one pointer is sometimes not enough Think of a linked list as a line of train cars. Each car… 46 The Two-Pointer Pattern on a Doubly Linked List🔒 Solving problems with two pointers A doubly linked list is a chain of boxes called nodes. Each node holds a value and tw… 47 Checking if a Doubly Linked List is a Palindrome Number🔒 Checking if a Doubly Linked List is a Palindrome Number Sometimes the digits of a number are stored one-by-one inside a … 48 Two Sum on a Sorted Doubly Linked List (Two-Pointer Trick)🔒 Finding Pairs That Add Up to a Target Imagine you have a line of numbers, and they are already sorted from smallest to l… 49 Two Sum in a Sorted Doubly Linked List (No Repeated Pairs)🔒 Finding Pairs That Add Up to a Target Imagine you have a line of numbers, already arranged from smallest to largest. Som… 50 Approximate Three Sum: Finding Three Numbers Closest to a Target🔒 Approximate Three Sum Imagine you have a row of numbers, and someone gives you a goal number called the target. Your tas… 51 The Reorder Pattern: Splitting and Merging a Linked List in Place🔒 The Reorder Pattern Some linked list problems ask you to rearrange the nodes of a list instead of changing their values.… 52 The Reorder Pattern: Splitting a Linked List and Joining It Back🔒 The Reorder Pattern in Linked Lists Some linked list problems ask you to rearrange the nodes that are already there — no… 53 Relocate Node: Moving the Last Node of a Doubly Linked List to the Front🔒 Relocate Node: Move the Last Node to the Start Imagine a line of train cars connected one after another. Each car is hoo… 54 Parity Order: Grouping Odd-Index and Even-Index Nodes in a Doubly Linked List🔒 Parity Order in a Doubly Linked List Let's learn how to rearrange a doubly linked list so that all the nodes sitting in … 55 Partitioning a Doubly Linked List Around a Value🔒 Partitioning a Doubly Linked List Around a Value X Imagine you have a line of train cars, and each car has a number pain… 56 Shuffle a Doubly Linked List Into Front-Back Order🔒 Shuffle a Doubly Linked List Imagine you have a line of people standing one behind the other, holding hands. Each person… 57 Designing a Doubly Linked List🔒 Designing a Doubly Linked List A linked list is a chain of small boxes. Each box holds a value and points to the next bo…