Data Structures
Part of the Interview Prep Roadmap. Coverage ratings are explained there.
Work through alongside this section
- NeetCode 150 — the single best-known curated list for coding interviews; its array, string, linked list, stack, tree, heap, and graph sections map onto the topics below. Worth finishing as a whole rather than cherry-picking.
- Blind 75 — the shorter list NeetCode 150 grew out of, if time is tight.
Arrays & Strings
Indexing, traversal, and in-place manipulation, building up to two-pointer and sliding-window techniques.
Coverage: rich
Resources · NeetCode — Arrays & Hashing · NeetCode — Two Pointers / Sliding Window
Array Fundamentals
- Indexing and memory layout
- Fixed-size vs. dynamic arrays
- Complexity of access, insertion, and deletion
Practice
- Arrays vs. linked lists on memory, access, insert, delete — Shanghai BD
- Second maximum of an array — Bevy Commerce
Traversal & In-Place Manipulation
- Iteration patterns
- Reversal and rotation
- Insertion and deletion within a fixed array
Practice
- Rotate an array right by k — Brain Station 23, with answer
- Reverse a string without library functions — Chaldal, with answer
- Sort by a given asc/desc criterion — Bevy Commerce
String Fundamentals
- Character encoding and representation
- Immutability and the cost of concatenation
- Common string operations
Practice
- Convert a numeric string to an integer — Chaldal, with answer
- Check whether a string is a palindrome — Chaldal, with answer
- Extract digits from a string — Chaldal, with answer
- Trim and collapse whitespace — Brain Station 23, with answer
Two-Pointer Technique
- Opposite-end pointers
- Fast and slow pointers
- Pair and triplet problems
Practice
- Two sum — bKash, with answer
- Pairs with a target sum in a doubly linked list — Therap, with answer
Sliding Window
- Fixed-size windows
- Variable-size windows
- Substring and subarray problems
Practice
- Find all anagram substrings — Chaldal, with answer
- Minimum window substring — Therap, with answer
- Nearby almost-duplicate pair — Kite Games, with answer
Prefix Sums
- Prefix sum arrays
- Range sum queries
- Difference arrays
Practice
- Range queries over an array — AppsCode
- Count values in range per query — Enosis
- Difference of odd- and even-indexed sums — Enosis
- Evaluate f(l, r) for many queries — Kite Games
Multidimensional Arrays
- 2D array traversal
- Matrix rotation and transposition
- Grid-based problems
Practice
- Rotate an n×n matrix 90° — Enosis, with answer
- Spiral matrix lookup — Chaldal, with answer
Linked Lists
Node structure, traversal, and basic insert/delete operations, then reversal, cycle detection, and building tree-like structures out of nodes.
Coverage: moderate
Resources · NeetCode — Linked List
Linked List Fundamentals
- Node structure and pointers
- Singly, doubly, and circular linked lists
- Comparison with arrays
Practice
- Array vs. linked list — Exabyting, with answer
- Advantages and disadvantages of linked lists — WellDev
- Which statement about a singly linked list is false — Brain Station 23
- Can binary search run on a sorted linked list — WellDev, with answer
Core Operations
- Traversal
- Insertion at head, tail, and middle
- Deletion
- Search
Practice
- Insert and delete in a doubly linked list — Shanghai BD
- Insertion and deletion in a circular list — WellDev
- Remove duplicates from a sorted list — bKash
Pointer Techniques
- Iterative and recursive reversal
- Fast and slow pointers
- Cycle detection
- Finding the middle node
- Nth node from the end
Practice
- Reverse a singly linked list — bKash, with answer
- Reverse every block of three nodes — Therap, with answer
- Remove the nth node from the end — Therap, with answer
- Nth from the end of a circular list — Brain Station 23, with answer
- Clone a list with random pointers — SRBD, with answer
Multi-List Problems
- Merging sorted lists
- Intersection of two lists
- Partitioning
Practice
- Merge two sorted linked lists — Therap, with answer
Stacks & Queues
What LIFO and FIFO mean, and the problems each is the right tool for — browser history, CPU scheduling, expression evaluation.
Coverage: moderate
Resources · NeetCode — Stack
Stack Fundamentals
- LIFO ordering
- Push, pop, and peek
- Array-based vs. linked-list-based implementation
Practice
- Stack, queue and priority queue — Exabyting, with answer
- Describe stacks and queues — WellDev
- Delete the middle element of a stack — WellDev
Stack Applications
- Expression notation (infix, prefix, postfix) and evaluation
- Balanced parentheses
- Undo history and browser navigation
- The function call stack
Practice
- Valid parentheses — bKash, with answer
- Convert infix to postfix — Brain Station 23
- Evaluate a postfix expression — National University
- Evaluate infix or postfix notation — Shanghai BD
- When is a stack the right choice — Brain Station 23
Queue Fundamentals
- FIFO ordering
- Enqueue and dequeue
- Circular queues
- Array-based vs. linked-list-based implementation
Practice
- Remaining capacity of a circular queue — Brain Station 23, with answer
- Deque operations — National University
Queue Variants & Applications
- Deque
- Priority queue
- CPU scheduling and buffering
- Monotonic stack and queue
Practice
- Build a stack out of a queue — WellDev, with answer
- A queue exposing its kth-last element — ShellBeeHaken
Trees & Binary Search Trees
Tree terminology and traversal order, binary search tree operations, tree properties (full/complete), and heaps as priority queues.
Coverage: rich
Resources · NeetCode — Trees & Heap/Priority Queue · VisuAlgo — tree visualisations
Tree Fundamentals
- Terminology: root, node, leaf, height, depth, degree
- Binary vs. n-ary trees
- Tree properties: full, complete, perfect, balanced
- Array and linked representations
Practice
- Full vs. complete binary tree — Brain Station 23
- Tree, binary tree and BST compared — Exabyting, with answer
- Build a tree from a list of nodes — Enosis
- Build a linked-node tree with left/right children — Enosis
Tree Traversal
- Inorder, preorder, and postorder
- Level-order traversal
- Recursive vs. iterative traversal
Practice
- Maximum depth of a binary tree — Chaldal, with answer
- Traverse a tree with a moving robot — Inverse AI
- Classify nodes from a parent/child table — Therap
Binary Search Trees
- BST ordering property
- Search, insertion, and deletion
- Degenerate trees and worst-case complexity
- Inorder successor and predecessor
- Lowest common ancestor
Practice
- Explain the BST property — Exabyting, with answer
- Binary tree vs. BST — Exabyting, with answer
- Insert a sorted array into a BST — Exabyting, with answer
- Search complexity in a balanced BST — Brain Station 23, with answer
- Lowest common ancestor in a BST — Brain Station 23, with answer
Balanced Trees
- Purpose of balancing
- Rotations
- AVL trees
- Red-black trees
Practice
Heaps & Priority Queues
- Min-heap and max-heap properties
- Array representation of a heap
- Heapify, insertion, and extraction
- Priority queue applications
Practice
- How a priority queue works internally — Enosis
- Ten smallest of a thousand unsorted numbers — Shanghai BD
Specialized Trees
- Trie (prefix tree)
- Segment tree
- Binary indexed tree (Fenwick tree)
Practice
- How a trie works, and implementing one — AppsCode
- Which structure suits a dictionary app — Brain Station 23
- Look-ups over a sorted word list — Therap, with answer
Graphs
Representation (adjacency list vs. matrix) and structural properties like bipartiteness. Traversal and shortest-path algorithms live under Graph Algorithms below.
Coverage: moderate
Resources · NeetCode — Graphs · VisuAlgo — graph structures
Graph Fundamentals
- Vertices and edges
- Directed vs. undirected graphs
- Weighted vs. unweighted graphs
- Degree, path, and cycle
Practice
Graph Representation
- Adjacency matrix
- Adjacency list
- Edge list
- Space and time trade-offs between representations
Practice
- Adjacency list vs. adjacency matrix — Brain Station 23
- How to represent a graph in code — WellDev
Graph Properties
- Connectivity and connected components
- Trees as a special case of graphs
- Bipartite graphs
- Dense vs. sparse graphs
- Directed acyclic graphs
Practice
- Identify the non-bipartite graph — Brain Station 23, with answer
- Count connected components — RoBenDevs, with answer
- Count disjoint clusters of cities — IQVIA
Hashing (Hash Tables & Maps)
How hashing works (hash functions, collisions), hash tables and hash maps, and when to reach for one over a tree or array.
Coverage: thin
Resources · NeetCode — Arrays & Hashing
Hashing Fundamentals
- Hash functions and their properties
- Hash tables, hash maps, and hash sets
- Average vs. worst-case complexity
Practice
- What hashing is, and what a collision is — AppsCode
mapvs.unordered_mapand their complexity — Exabyting, with answer
Collision Handling
- Separate chaining
- Open addressing (linear probing, quadratic probing, double hashing)
- Load factor and rehashing
Practice
- How collisions arise and are handled — AppsCode
Applications
- Frequency counting
- Deduplication and membership testing
- Caching and lookup tables
- Choosing a hash map over a tree or array
Practice