Linked List Data Structure
Last Updated :
04 Jan, 2025
Improve
A linked list is a fundamental data structure in computer science. It mainly allows efficient insertion and deletion operations compared to arrays. Like arrays, it is also used to implement other data structures like stack, queue and deque. Here’s the comparison of Linked List vs Arrays
Linked List:
- Data Structure: Non-contiguous
- Memory Allocation: Typically allocated one by one to individual elements
- Insertion/Deletion: Efficient
- Access: Sequential
Array:
- Data Structure: Contiguous
- Memory Allocation: Typically allocated to the whole array
- Insertion/Deletion: Inefficient
- Access: Random
Basics of Linked List:
Operations of Linked Lists:
- Length of Linked List
- Print Linked List
- Linked List Insertion
- Search in a Linked List
- Deleting a given key
- Deleting at given position
- Delete a Linked List
- Nth Node from Start
- Nth Node from End
- Size of Doubly Linked List
Easy Problems on Linked List:
- Remove every k-th node
- Middle of a Linked List
- Count Occurrences in a Linked List
- Circular Linked List Traversal
- Check if Circular
- Count Nodes in Circular List
- Deletion from a Circular Linked List
- Singly to circular Conversion
- Exchange first and last nodes in Circular
- Delete in a Doubly Linked List
- Reverse a Singly Linked List
- Reverse a Doubly Linked List
Medium Problems on Linked List:
- Swap Nodes in Pairs
- Detect loop in a linked list
- Length of loop in linked list
- Design Browser History
- Remove duplicates from a sorted linked list
- Remove Duplicates from an Unsorted Linked List
- Intersection of two Sorted Linked Lists
- Partition a List
- QuickSort on Singly Linked List
- Split a Circular Linked List into two halves
- Merge Two Sorted Linked Lists
- Union and Intersection
- Merge Sort for Doubly Linked List
- Pairs with Sum in doubly linked list
- Insert in sorted way in doubly linked list
- Remove duplicates from an unsorted DLL
- Rotate a Linked List
- Rotate Doubly linked list by N nodes
- Delete a node with only its pointer given
- Segregate even and odd nodes
Hard Problems on Linked List:
- Merge K Sorted Lists
- Intersection point of two Linked Lists.
- Implement LRU Cache
- Josephus Circle using circular linked list
- The Great Tree-List Recursion Problem.
- Clone a linked list with random pointer
- Binary Tree to Doubly Linked List | Set
- Reverse a Singly Linked List in Groups
- Reverse a Doubly Linked List in Groups
- Sublist Search (Search a linked list in another list)
- Construct a linked list from 2D matrix
- Rotate Linked List block wise
- Multiply two numbers represented by Lists
- Delete N nodes after M nodes
Quick Links :
Recommended: