Data Structures and Algorithms
Begin with arrays, linked lists, stacks, queues, trees, and graphs. Each lesson shows how the data is laid out, how common operations work, and what those operations cost.
The algorithm lessons build on those structures. Sorting explains how order is created; searching explains how ordered data lets a program discard work.
Start with the foundations
Learn how to describe an operation, estimate its running time, and choose storage that matches the work a program performs.
- Time and Space Complexitylesson
Compare constant, logarithmic, linear, and quadratic growth before choosing an implementation.
- Recursionlesson
Break a problem into smaller calls and understand the call stack and base case.
- Data Structureslesson
How values are arranged, accessed, inserted, removed, and updated.
Linear data structures
These structures keep values in a sequence. The important difference is how each one finds, inserts, and removes an item.
- Arrayslesson
Contiguous memory, indexes, traversal, insertion, deletion, and dynamic resizing.
- Static vs Dynamic Arrayslesson
Understand the difference between fixed-size memory blocks and auto-expanding lists.
- Multidimensional Arrayslesson
Learn how grids and matrices are mapped onto linear computer memory.
- Prefix Sumslesson
Query the sum of any subarray in constant time using a precomputed array.
- Difference Arrayslesson
Apply massive overlapping range updates in constant time per update.
- Sparse Arrayslesson
Store massive arrays efficiently when most of their elements are zero or empty.
- Linked Listslesson
Nodes, references, traversal, insertion, deletion, and reversal.
- Singly Linked Listslesson
Master the mechanics of one-way node traversal and the fast/slow pointer technique.
- Doubly Linked Listslesson
Leverage backward pointers for O(1) deletions and complex caching structures.
- Circular Linked Listslesson
Build a continuous ring of nodes where the tail connects back to the head.
- Stacks and Queueslesson
Last-in-first-out and first-in-first-out processing with practical examples.
- Stack Implementation and Applicationslesson
Explore array vs linked-list implementations and expression evaluation.
- Queue Implementation and Applicationslesson
Explore the First-In-First-Out processing model and its critical role in BFS.
- Circular Queueslesson
Use modulo arithmetic to build efficient, fixed-size ring buffers.
- Dequeslesson
Double-ended queues allow insertion and deletion at both the front and rear.
- Stringslesson
Character storage, scanning, matching, prefixes, and frequency counting.
Advanced structures and algorithms
Structures that combine concepts or maintain strict invariants to achieve faster lookups and dynamic state management.
- Skip Listslesson
Achieve O(log N) search times in a linked list using multiple layers of express lanes.
- Monotonic Stackslesson
Maintain a strictly increasing or decreasing invariant to solve 'next greater element' problems.
- Monotonic Queueslesson
Combine a deque with a monotonic invariant to conquer sliding window problems.
- Segment Treeslesson
Query and update arbitrary array intervals in logarithmic time.
- Fenwick Treeslesson
Implement Binary Indexed Trees for hyper-efficient prefix sums with minimal memory.
- Lowest Common Ancestorlesson
Find the deepest node that is an ancestor of two specific targets.
- Tree Diameter and Heightlesson
Calculate the longest path between any two nodes in a tree structure.
- Suffix Arrayslesson
Sort all suffixes of a string to solve complex substring problems efficiently.
- Suffix Treeslesson
Compress all suffixes of a string into a powerful, navigatable Trie.
- Bloom Filterslesson
Trade absolute certainty for immense space savings in set membership queries.
Trees, graphs, and indexed structures
Use these when relationships branch, connect in many directions, or need faster lookup than a simple scan.
- Priority Queueslesson
Learn how priority queues process the most urgent items first using heap structures.
- Treeslesson
Roots, children, depth, traversal, binary search trees, and balanced trees.
- Binary Treeslesson
Understand the foundations of binary trees, nodes, leaves, and hierarchical data.
- Binary Search Treeslesson
Learn how the BST property enables fast lookups and sorted retrievals.
- AVL Treeslesson
Master self-balancing trees using height differentials and rotations.
- Red-Black Treeslesson
Explore the relaxed balancing rules that power standard library maps and sets.
- B-Trees and B+ Treeslesson
Learn the wide, shallow trees designed specifically for disk storage and databases.
- Tree Traversalslesson
Explore Pre-order, In-order, Post-order, and Level-order traversal strategies.
- Trie Operations and Applicationslesson
Build efficient prefix trees for autocomplete and string dictionaries.
- Graphslesson
Vertices, edges, breadth-first search, depth-first search, and visited sets.
- Hash Tableslesson
Keys, hash functions, collisions, sets, maps, and constant-time lookup.
- Heaps and Priority Queueslesson
Maintain the smallest or largest available item while values are added and removed.
- Trieslesson
Store words by shared prefixes for lookup and autocomplete.
- Disjoint Setslesson
Track connected components with union and find operations.
Core algorithms
Algorithms transform or inspect the structures above. Begin with ordering and lookup, then move to ways of exploring choices.
- Sorting Algorithmslesson
Compare selection, insertion, merge, quick, and heap-based sorting.
- Searching Algorithmslesson
Linear search, binary search, and the conditions that make binary search valid.
- Two Pointerslesson
Move two indexes through a sequence without repeatedly rescanning it.
- Sliding Windowlesson
Maintain a changing range while adding and removing boundary values.
- Backtrackinglesson
Choose, explore, undo, and continue through combinations and arrangements.
Problem-solving methods
These methods help when a direct scan is not enough and a problem has overlapping choices, local decisions, or repeated subproblems.
- Dynamic Programminglesson
Save answers to repeated subproblems and build the final answer from them.
- Greedy Algorithmslesson
Make the best safe local choice and explain why it cannot damage the final answer.
- Advanced Graph Algorithmslesson
Shortest paths, topological ordering, minimum spanning trees, and connectivity.
- Bit Manipulationlesson
Use fast bitwise operators to represent sets or do math at the hardware level.