Skip to content

Data Structures & Algorithms in C++ (Interview-Grade)

Turn your C++ fluency into problem-solving power.

Turn your C++ fluency into problem-solving power. You implement every core data structure and algorithm from scratch in modern C++ — dynamic arrays, linked lists, stacks/queues, trees, heaps, tries, hash tables, and graphs — then master the algorithmic techniques common in technical interviews: two pointers, sliding window, recursion, binary search, sorting, BFS/DFS, shortest paths, greedy, divide-and-conquer, backtracking, and dynamic programming. Every project pairs a working implementation with complexity analysis and the interview patterns it practises. Note the division of labour with the c-systems track: c-systems hand-rolls a vector, linked list, hash table and ring buffer in C as exercises in memory ownership and API design, because C ships no containers at all. This track is the algorithms course - complexity analysis, balanced trees, graph algorithms and the design paradigms - and it is where the structures c-systems deliberately defers are taught. This is the shared problem-solving core of the Zero-to-Low-Level-Systems-Elite program: it takes the language from cpp-from-zero and builds the timed, whiteboard-style algorithmic skill that technical interviews commonly test.

6 phases · 48 projects · v1.1.0

Target roles: Software Engineer (technical interview preparation), Low-Latency / HFT Engineer (foundation), AI-Chip / Systems Engineer (foundation), Competitive Programmer

Stack: C++17/20, g++/clang++, CMake, GoogleTest

PHASE 1 · 8 projects

Complexity & Array Foundations

Reason about running time with Big-O and master array techniques: dynamic arrays, two pointers, sliding window, prefix sums, and matrices.

  1. 01 · featured

    Big-O Notation & Measuring Growth

    Build intuition for asymptotic complexity by implementing the five common complexity classes, deriving Big-O from code, and empirically timing algorithms with std::chrono to watch growth curves diverge.

    C++17/20 · std::chrono · std::vector · std::unordered_set

  2. 02 · featured

    Arrays & Traversal Patterns

    Master the fundamental array traversal patterns — find max/min, count, accumulate, and in-place modify — using std::vector, and observe why contiguous memory and cache-friendliness make arrays fast in practice.

    C++17/20 · std::vector · std::chrono

  3. 03 · featured

    Dynamic Arrays & Amortized Analysis

    Build a minimal MyVector<T> from scratch with new[]/delete[] and capacity doubling, then prove that push_back is amortized O(1) using the aggregate counting method.

    C++17/20 · templates · RAII · new[]/delete[]

  4. 04 · featured

    The Two-Pointer Technique

    Implement four classic two-pointer problems — reverse in place, pair-sum on sorted array, remove duplicates, and palindrome check — and prove each is O(n) vs the O(n²) naive approach.

    C++17/20 · std::vector · std::string · std::optional

  5. 05 · featured

    The Sliding Window Technique

    Solve fixed-window and variable-window subarray problems — max-sum of size-k subarray, longest unique substring, minimum-length sum window — in O(n) using a sliding window, and contrast with O(n²) naive solutions.

    C++17/20 · std::vector · std::string · std::unordered_map · std::chrono

  6. 06 · featured

    Prefix Sums & Range Queries

    Build 1D and 2D prefix-sum arrays to answer arbitrary range-sum queries in O(1), implement a difference array for O(1) range updates, and understand the preprocessing vs query time tradeoff.

    C++17/20 · std::vector · std::chrono · std::mt19937

  7. 07 · featured

    2D Arrays & Matrix Traversal

    Implement row-major traversal, spiral and diagonal iteration, and in-place transpose and 90° rotation of a square matrix, expressing all complexity in terms of both m and n.

    C++17/20 · std::vector · std::algorithm · std::iomanip

  8. 08 · featured

    Array Algorithms Toolkit (Finale)

    Synthesise all Phase 1 techniques — two-pointer, sliding window, prefix sums, and matrix operations — into a single CLI toolkit with a complexity reference table, a benchmark, and a problem-triage decision guide.

    C++17/20 · std::vector · std::chrono · std::algorithm · std::unordered_map

PHASE 2 · 8 projects

Linear Structures: Lists, Stacks & Queues

Build the pointer-based linear structures from scratch: singly/doubly linked lists, stacks, queues, deques, and their classic applications.

  1. 01 · featured

    Singly Linked List

    Build a templated SinglyLinkedList<T> from scratch using raw node pointers, implementing push_front (O(1)), push_back (O(n)), remove, search, traversal, and a correct RAII destructor with full Rule of Five compliance.

    C++17/20 · raw pointers · RAII · Rule of Five · class templates

  2. 02 · featured

    Doubly Linked List

    Build a templated DoublyLinkedList<T> with prev/next pointers and head/tail anchors, enabling O(1) insert and delete at both ends and O(1) node removal given a pointer handle.

    C++17/20 · raw pointers · RAII · Rule of Five · class templates

  3. 03 · featured

    Linked List Algorithms

    Implement the four classic interview linked-list algorithms — in-place reversal (iterative and recursive), Floyd's cycle detection, slow/fast middle-finding, and sorted list merge — each as a stand-alone O(1)-space program.

    C++17/20 · raw pointers · two-pointer technique · Floyd's algorithm

  4. 04 · featured

    Stack (LIFO)

    Implement the Stack ADT two ways — a fixed-capacity array-backed ArrayStack<T,N> with zero runtime allocation and a dynamically growing LinkedStack<T> backed by linked nodes — then compare their complexity and allocation trade-offs.

    C++17/20 · non-type template parameters · raw pointers · RAII · std::array

  5. 05 · featured

    Queue & Circular Buffer

    Implement the Queue ADT as a linked-node queue with O(1) enqueue/dequeue and then as a fixed-size circular ring buffer with modulo wrap-around, zero runtime allocation, and a count-based full/empty disambiguation.

    C++17/20 · std::array · raw pointers · RAII · modulo arithmetic · non-type template parameters

  6. 06 · featured

    Deque (Double-Ended Queue)

    Build a Deque<T> backed by a doubly linked list with O(1) push/pop at both ends, then implement the sliding-window maximum using a monotonic deque to show the structure's canonical O(n) application.

    C++17/20 · std::deque · doubly linked list · monotonic deque · sliding window

  7. 07 · featured

    Applications of Stacks & Queues

    Implement four canonical algorithms that demonstrate the power of LIFO and FIFO disciplines: balanced bracket checking, Shunting-Yard infix-to-postfix conversion with postfix evaluation, next-greater-element via a monotonic stack, and a BFS level-order traversal preview.

    C++17/20 · std::stack · std::queue · std::deque · monotonic stack · Shunting-Yard

  8. 08 · featured

    LRU Cache

    Build an O(1) Least-Recently-Used cache by composing std::unordered_map with a hand-written doubly linked list (with sentinel nodes), implementing get and put in strictly O(1) time with correct LRU eviction and move-to-front on access.

    C++17/20 · std::unordered_map · doubly linked list · sentinel nodes · RAII · data structure composition

PHASE 3 · 8 projects

Recursion, Searching & Sorting

Master recursion and the canonical algorithms: binary search, merge/quick/heap sort, and the analysis that explains why each performs as it does.

  1. 01 · featured

    Recursion & the Call Stack

    Build factorial, Fibonacci, and exponentiation recursively, trace the call stack frame-by-frame, observe exponential blow-up, fix it with memoisation, and understand tail recursion — tying hardware stack mechanics to algorithmic reasoning.

    C++20 · g++ · chrono

  2. 02 · featured

    Binary Search & Its Variants

    Implement classic binary search with overflow-safe mid, then build lower_bound and upper_bound from scratch, search a rotated sorted array, and apply binary search on the answer to an optimisation problem — understanding the loop invariant that makes each variant correct.

    C++20 · g++ · <algorithm>

  3. 03 · featured

    Elementary Sorts

    Implement bubble, selection, and insertion sort from scratch with comparison/swap counters, compare their behaviour on sorted, random, and reverse inputs, and understand stability, in-place sorting, and why insertion sort remains relevant inside every production sort library.

    C++20 · g++ · <algorithm> · <random>

  4. 04 · featured

    Merge Sort (Divide & Conquer)

    Implement merge sort from scratch — the merge step, recursive split, and bottom-up iterative variant — derive T(n) = 2T(n/2) + O(n) via the recursion tree, verify O(n log n) time and O(n) space, and confirm stability with a keyed-record test.

    C++20 · g++ · <vector> · <algorithm>

  5. 05 · featured

    Quick Sort & Partitioning

    Implement Lomuto and Hoare partition schemes, observe the O(n^2) worst case with fixed pivot on sorted input, eliminate it with randomised pivot selection, and handle duplicates efficiently with three-way Dutch National Flag partitioning.

    C++20 · g++ · <random> · <chrono> · <algorithm>

  6. 06 · featured

    Heap Sort & the Binary Heap

    Build an array-based binary max-heap from scratch with sift_up, sift_down, and O(n) heapify, then implement heap sort (in-place, O(n log n), not stable) and a full priority queue interface — the same heap that powers Dijkstra and std::priority_queue.

    C++20 · g++ · <vector> · <algorithm> · <chrono>

  7. 07 · featured

    Choosing a Sort: Analysis, Stability & std::sort

    Consolidate all six sorting algorithms into a comparison table, prove the Omega(n log n) comparison lower bound with a decision-tree argument, implement counting sort and radix sort from scratch, and learn what std::sort (introsort) and std::stable_sort actually do.

    C++20 · g++ · <algorithm> · <chrono> · <iomanip>

  8. 08 · featured

    Searching & Sorting Toolkit

    Build a header-only toolkit.hpp exposing binary_search, lower_bound, merge_sort, quick_sort, and heap_sort, then benchmark all five against std::sort and std::stable_sort on random, sorted, and reversed inputs using <chrono>, and write a structured empirical analysis tying the numbers back to algorithmic theory.

    C++20 · g++ · -O2 · <chrono> · <random> · <algorithm>

PHASE 4 · 8 projects

Trees, Heaps & Tries

Implement hierarchical structures: binary trees and BSTs, balancing, binary heaps/priority queues, tries, and range-query trees.

  1. 01 · featured

    Binary Trees & Traversals

    Build a binary tree from scratch with RAII cleanup and implement all four traversals — preorder, inorder, postorder (recursive and iterative with an explicit stack), and level-order BFS — to understand how the call stack and data-structure traversal relate.

    C++20 · std::stack · std::queue · g++

  2. 02 · featured

    Binary Search Tree

    Build a full BST with insert, search, and delete (all three cases including two-children/inorder-successor) from scratch, and confirm that inorder traversal always yields sorted output.

    C++20 · g++

  3. 03 · featured

    Tree Algorithms

    Implement the eight classic interview tree algorithms — height, balanced-check, diameter, LCA, validate-BST, invert, and path-sum — each demonstrating a distinct recursive postorder-reduction pattern.

    C++20 · g++

  4. 04 · featured

    Balanced Trees & Rotations

    Implement an AVL self-balancing BST from scratch — height-tracked nodes, left/right rotations, all four imbalance cases (LL/RR/LR/RL), and insert with automatic rebalancing — proving that O(log n) height is maintained regardless of input order.

    C++20 · g++

  5. 05 · featured

    Binary Heap & Priority Queue

    Implement an array-backed max-heap with sift-up push, sift-down pop, and O(n) build_heap, then generalize it as a PriorityQueue<T,Comp> class template that works as min- or max-heap, and apply it to the top-K streaming problem.

    C++20 · std::vector · std::less · std::greater · g++

  6. 06 · featured

    Trie (Prefix Tree)

    Build a trie from scratch with 26-slot array children and an end-of-word flag, implementing insert, search, startsWith, and an autocomplete function via DFS-with-backtracking.

    C++20 · std::array · std::unordered_map · g++

  7. 07 · featured

    Range-Query Trees: Fenwick & Segment Tree

    Build a Fenwick tree (BIT) for O(log n) prefix-sum update and query using the lowbit trick, then build a segment tree supporting both range-sum and range-min queries with point updates, and compare when each structure is appropriate.

    C++20 · std::vector · g++

  8. 08 · featured

    Tree Toolkit: Huffman Coding

    Synthesize Phase 4 by building a complete Huffman coding pipeline: frequency table, greedy tree construction with a min-heap, prefix-free codebook generation by tree traversal, encode a string to bits, and decode using the tree as a trie.

    C++20 · std::priority_queue · std::unordered_map · g++

PHASE 5 · 8 projects

Hashing & Graphs

Build hash tables and graph algorithms: collision handling, hashing patterns, BFS/DFS, shortest paths, and topological sort.

  1. 01 · featured

    Hash Tables from Scratch

    Build a HashMap<K,V> with separate chaining, load-factor-triggered resize, and average O(1) insert/find/erase, then compare against std::unordered_map.

    C++20 · std::hash · std::vector · std::list

  2. 02 · featured

    Open Addressing & Hashing Internals

    Build a FlatMap<K,V> with linear probing and tombstone deletion, implement double hashing to eliminate clustering, and compare cache behavior against separate chaining.

    C++20 · std::vector · std::hash · std::optional

  3. 03 · featured

    Hashing Interview Patterns

    Implement five canonical hashing patterns — frequency counting, deduplication, two-sum, group anagrams, and subarray-sum-equals-k — each turning an O(n²) brute force into an O(n) solution.

    C++20 · std::unordered_map · std::unordered_set · std::optional

  4. 04 · featured

    Graph Representations

    Build a reusable Graph class with adjacency-list and adjacency-matrix representations for directed/undirected weighted graphs, analyze space and time tradeoffs, and load graphs from edge lists.

    C++20 · std::vector · std::pair

  5. 05 · featured

    Breadth-First Search

    Implement BFS with a queue on the Project 4 Graph class to compute shortest unweighted paths, find connected components, and solve a grid maze with an implicit graph.

    C++20 · std::queue · std::vector · graph.hpp

  6. 06 · featured

    Depth-First Search

    Implement recursive and iterative DFS on the Project 4 Graph class, detect directed cycles with three-color marking, detect undirected cycles with parent tracking, and enumerate all paths with backtracking.

    C++20 · std::stack · std::vector · std::function · graph.hpp

  7. 07 · featured

    Weighted Shortest Paths & Topological Sort

    Implement Dijkstra's algorithm with a min-heap priority queue for non-negative weighted shortest paths, and topological sort via both DFS post-order and Kahn's BFS algorithm with cycle detection.

    C++20 · std::priority_queue · std::queue · std::function · graph.hpp

  8. 08 · featured

    Graph Toolkit

    Synthesise the phase: build a GridPathfinder running BFS and Dijkstra on weighted terrain, implement Union-Find with path compression and union by rank, and apply it to Kruskal-style connectivity.

    C++20 · std::priority_queue · std::queue · std::vector · std::iota · graph.hpp

PHASE 6 · 8 projects

Algorithm Design & Interview Mastery

Wield the big algorithmic paradigms — greedy, divide-and-conquer, backtracking, and dynamic programming — and assemble a tested capstone.

  1. 01 · featured

    Greedy Algorithms

    Build four greedy classics from scratch — interval scheduling, coin change (with DP counterexample), fractional knapsack, and Huffman coding — proving each correct or wrong via the exchange argument.

    C++20 · STL priority_queue · std::sort · g++

  2. 02 · featured

    Divide & Conquer

    Implement maximum subarray (D&C vs Kadane), inversion counting via merge sort, and fast exponentiation, then apply the Master Theorem to analyze the recurrence of each.

    C++20 · recursion · std::vector · g++

  3. 03 · featured

    Backtracking

    Implement permutations, subsets, combinations, N-Queens, and a Sudoku solver using the choose/explore/un-choose template, then quantify how pruning reduces nodes visited exponentially.

    C++20 · recursion · std::vector · std::array · std::function · g++

  4. 04 · featured

    Dynamic Programming I (1D)

    Implement Fibonacci, climbing stairs, house robber, coin change (minimum coins), and LIS from scratch using both memoization and tabulation, deriving each recurrence from first principles.

    C++20 · std::vector · std::unordered_map · std::chrono · g++

  5. 05 · featured

    Dynamic Programming II (2D & Sequences)

    Implement grid unique-paths, min-path-sum, 0/1 knapsack, LCS, and edit distance with full 2D tables and space-compressed variants, including solution reconstruction for LCS.

    C++20 · std::vector · std::string · std::algorithm · g++

  6. 06 · featured

    Bit Manipulation

    Implement ten canonical bit tricks (check/set/clear/toggle, LSB, popcount, power-of-2, XOR swap, single number, bitmask subsets), explain their two's complement mechanics, and apply them to HFT-style flag operations.

    C++20 · std::bitset · std::popcount · std::has_single_bit · g++

  7. 07 · featured

    Interview Patterns & Problem-Solving Framework

    Build a systematic problem-solving framework mapping 8 signal patterns to algorithms, implement the same problem two ways with explicit tradeoff analysis, and study the complexity targets and LeetCode strategy that make pattern mastery stick.

    C++20 · std::priority_queue · std::unordered_map · g++

  8. 08 · featured

    Autocomplete & Route-Planning Engine (Track Capstone)

    Build a CMake-packaged, GoogleTest-tested C++ application combining a Trie-backed autocomplete (top-k via heap) and a weighted-graph route planner (Dijkstra), structured as a library + thin CLI with 10 tests covering happy paths and edge cases.

    C++20 · CMake 3.14+ · GoogleTest 1.14 · FetchContent · std::unique_ptr · std::priority_queue · std::unordered_map · g++

Next step

Request Data Structures & Algorithms in C++ (Interview-Grade)

An advisor reviews the fit and confirms terms in writing. A request is not an acceptance and nothing is charged until you agree.