Data Structure and Algorithm Mastery
This repository contains curated structural blueprints, core patterns, algorithmic pseudocode, and complexity analysis guides.
Each subfolder contains a dedicated README.md breaking down the core structural patterns, algorithmic blueprints, Big-O metrics, and target interview checklists:
-
-
Pattern: Two-Pointer / Sliding Window (
$O(N)$ Time,$O(1)$ Space) - Practice Targets: Designer PDF Viewer, Left Rotation
-
Pattern: Two-Pointer / Sliding Window (
-
-
Pattern: Floyd's Tortoise and Hare Cycle Detection (
$O(N)$ Time,$O(1)$ Space) - Practice Targets: Insert a Node at a Position, Cycle Detection
-
Pattern: Floyd's Tortoise and Hare Cycle Detection (
-
-
Pattern: LIFO Symmetry Tracking (
$O(N)$ Time,$O(N)$ Space) - Practice Targets: Balanced Brackets, Queue Using Two Stacks
-
Pattern: LIFO Symmetry Tracking (
-
-
Pattern: Complement Target Lookup (
$O(N)$ Time,$O(N)$ Space) - Practice Targets: Ice Cream Parlor, Colorful Number
-
Pattern: Complement Target Lookup (
-
-
Pattern: Preprocessing & Divide and Conquer (
$O(N \log N)$ Time) - Practice Targets: Insertion Sort part 2, Quicksort part 2
-
Pattern: Preprocessing & Divide and Conquer (
-
-
Pattern: Recursive Subtree Depth Calculation (
$O(N)$ Time,$O(H)$ Space) - Practice Targets: Binary Tree Insertion, Height of a Binary Tree, QHeap1
-
Pattern: Recursive Subtree Depth Calculation (
-
-
Pattern: Breadth-First Level Traversal (
$O(V + E)$ Time,$O(V)$ Space) - Practice Targets: Breadth-First Search Snakes and Ladders
-
Pattern: Breadth-First Level Traversal (
-
Topic 8: Recursion & Backtracking
-
Pattern: State Exploration & Reversal / Backtracking (
$O(K^N)$ Time,$O(N)$ Space) - Practice Targets: Fibonacci Numbers
-
Pattern: State Exploration & Reversal / Backtracking (
-
-
Pattern: Memoized Top-Down State Overlap (
$O(\text{States})$ Time,$O(\text{States})$ Space) - Practice Targets: Optimization and State Memoization Caching
-
Pattern: Memoized Top-Down State Overlap (
Before beginning any problem, run through this universal operational execution sequence:
- The 2-Minute Requirement Check: Do not type immediately. Ask clarifying questions on constraints (e.g., negative numbers, empty arrays, null structures).
- State a Brute Force Baseline: Explicitly state the simple, non-optimal solution (e.g.,
$O(N^2)$ nested loop) to set a time complexity benchmark. - Propose the Optimization: Formulate an argument explaining why a specific data structure (e.g., Hash Map, Queue) lowers the runtime bounds.
- Speak Aloud While Coding: Continuously communicate your logic and structural implementation choices to the interviewer.
- Dry-Run Trace: Verbally track a custom test case through your completed function line-by-line to catch logical syntax bugs or edge cases before hitting compile.