Linked Lists

Understand pointer manipulation and list operations

Linked Lists are linear data structures where elements are stored in nodes. Each node contains data and a reference (link) to the next node. They excel at insertions and deletions but require sequential access.

Key Concepts

  • Dynamic size - grow and shrink at runtime
  • Efficient insertions/deletions at O(1) with pointer
  • No random access - requires O(n) traversal
  • No wasted memory from pre-allocation
  • Variants: Singly, Doubly, Circular linked lists

Problems

Reverse Linked List

EasySoon

Reverse a singly linked list iteratively and recursively

PointersRecursion

Merge Two Sorted Lists

EasySoon

Merge two sorted linked lists into one

Two PointersRecursion

Linked List Cycle

EasySoon

Detect if a linked list has a cycle

Floyd's AlgorithmTwo Pointers

Remove Nth Node From End

MediumSoon

Remove the nth node from the end of the list

Two PointersOne Pass

Add Two Numbers

MediumSoon

Add two numbers represented by linked lists

MathLinked List

Copy List with Random Pointer

MediumSoon

Deep copy a linked list with random pointers

Hash MapLinked List
Linked Lists - DSA Visualizer | AllVisualizer