Linked Lists
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 points
- 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
EasyReverse a singly linked list iteratively and recursively
PointersRecursion
Open Merge Two Sorted Lists
Coming soonMerge two sorted linked lists into one
Two PointersRecursion
Linked List Cycle
Coming soonDetect if a linked list has a cycle
Floyd's AlgorithmTwo Pointers
Remove Nth Node From End
Coming soonRemove the nth node from the end of the list
Two PointersOne Pass
Add Two Numbers
Coming soonAdd two numbers represented by linked lists
MathLinked List
Copy List with Random Pointer
Coming soonDeep copy a linked list with random pointers
Hash MapLinked List