A structured, pattern-based curriculum to master Data Structures and Algorithms for FAANG interviews and competitive programming.
This curriculum is built on one core principle: pattern recognition beats memorization.
Every algorithm problem is a combination of known patterns. Master the patterns, and you can solve any problem — even ones you've never seen before.
flowchart LR
A["Learn Pattern"] --> B["Recognize Pattern\nin New Problems"]
B --> C["Apply & Adapt"]
C --> D["Combine Patterns\nfor Hard Problems"]
D --> E["Algorithm\nMastery"]
- Senior engineers preparing for FAANG-level algorithm interviews
- Developers who want structured, systematic algorithm training
- Competitive programming aspirants building their pattern library
- Anyone who knows C# or TypeScript and wants to think algorithmically
AdvanceDataStructureAlgorithm/
│
├── docs/ # Foundation documents
│ ├── algorithm-thinking.md # Mental framework for problem solving
│ ├── complexity-analysis.md # Big-O mastery guide
│ ├── pattern-recognition.md # Pattern identification system
│ └── interview-strategy.md # 45-minute interview game plan
│
├── patterns/ # Core pattern library (20 patterns)
│ ├── 01_two_pointers/ # Sorted arrays, pair finding
│ ├── 02_sliding_window/ # Contiguous subarrays/substrings
│ ├── 03_fast_slow_pointer/ # Cycle detection, linked lists
│ ├── 04_binary_search/ # Search spaces, optimization
│ ├── 05_prefix_sum/ # Range queries, cumulative ops
│ ├── 06_monotonic_stack/ # Next greater/smaller element
│ ├── 07_heap_priority_queue/ # Top-K, merge-K, median
│ ├── 08_backtracking/ # Combinations, permutations
│ ├── 09_dynamic_programming/ # Optimization, counting
│ ├── 10_greedy/ # Local optimal = global optimal
│ ├── 11_graph_traversal/ # BFS, DFS, shortest paths
│ ├── 12_union_find/ # Dynamic connectivity
│ ├── 13_topological_sort/ # Dependency ordering
│ ├── 14_trie/ # Prefix matching
│ ├── 15_segment_tree/ # Range queries with updates
│ ├── 16_fenwick_tree/ # Binary indexed tree
│ ├── 17_bit_manipulation/ # Bitwise tricks
│ ├── 18_divide_and_conquer/ # Split, solve, combine
│ ├── 19_advanced_dp/ # Bitmask, interval, digit DP
│ └── 20_advanced_graph/ # Dijkstra, MST, flow
│
├── practice/ # Curated problem sets
│ ├── easy/ # 20 problems — build confidence
│ ├── medium/ # 30 problems — build speed
│ └── hard/ # 25 problems — build mastery
│
└── README.md # This file
Each pattern folder contains:
concept.md— Theory, intuition, and templatesvisual.md— Mermaid diagrams for visual learnersproblems.md— Curated problems with step-by-step solutionscsharp/— Clean C# implementationstypescript/— Clean TypeScript implementations
Build the mental framework before diving into patterns.
flowchart TD
A["Algorithm Thinking\n(docs/algorithm-thinking.md)"] --> B["Complexity Analysis\n(docs/complexity-analysis.md)"]
B --> C["Pattern Recognition\n(docs/pattern-recognition.md)"]
C --> D["Interview Strategy\n(docs/interview-strategy.md)"]
D --> E["Ready for Patterns"]
style E fill:#00cc00,color:#000
Goal: Understand the 5-step problem-solving framework, master Big-O analysis, and learn the pattern recognition decision tree.
Learn one pattern at a time. For each pattern: read concept → study visuals → solve 3-5 problems.
flowchart TD
subgraph "Week 3-4: Array Patterns"
P1["01 Two Pointers"] --> P2["02 Sliding Window"]
P2 --> P3["03 Fast & Slow"]
P3 --> P4["04 Binary Search"]
P4 --> P5["05 Prefix Sum"]
end
subgraph "Week 5-6: Stack, Heap, Recursion"
P6["06 Monotonic Stack"] --> P7["07 Heap"]
P7 --> P8["08 Backtracking"]
end
subgraph "Week 7-8: DP & Greedy"
P9["09 Dynamic Programming"] --> P10["10 Greedy"]
end
P5 --> P6
P8 --> P9
Goal: Recognize and apply each pattern independently. Solve easy/medium problems for each.
flowchart TD
subgraph "Week 9-10: Graph Fundamentals"
P11["11 Graph Traversal"] --> P12["12 Union-Find"]
P12 --> P13["13 Topological Sort"]
end
subgraph "Week 11-12: Advanced Data Structures"
P14["14 Trie"] --> P15["15 Segment Tree"]
P15 --> P16["16 Fenwick Tree"]
end
P13 --> P14
Goal: Handle graph problems confidently. Know when to use specialized data structures.
flowchart TD
subgraph "Week 13-14: Advanced Techniques"
P17["17 Bit Manipulation"] --> P18["18 Divide & Conquer"]
P18 --> P19["19 Advanced DP"]
end
subgraph "Week 15-16: Competition Level"
P20["20 Advanced Graph"] --> MIXED["Mixed Hard Problems"]
end
P19 --> P20
Goal: Solve hard problems that combine multiple patterns. Competitive programming readiness.
flowchart LR
A["Timed Practice\n(25 min per medium)"] --> B["Mock Interviews\n(45 min sessions)"]
B --> C["Weak Area Review\n(revisit tough patterns)"]
C --> D["Daily 1 Problem\n(maintain sharpness)"]
D --> E["Interview Ready"]
style E fill:#00cc00,color:#000
Use this table when you encounter a new problem:
| Signal | Pattern | Section |
|---|---|---|
| Sorted array, find pair | Two Pointers | 01 |
| Contiguous subarray/substring | Sliding Window | 02 |
| Linked list cycle | Fast & Slow | 03 |
| Search in sorted / minimize max | Binary Search | 04 |
| Range sum queries | Prefix Sum | 05 |
| Next greater/smaller | Monotonic Stack | 06 |
| Top K / merge K | Heap | 07 |
| Generate all possibilities | Backtracking | 08 |
| Count ways / min cost / feasibility | DP | 09 |
| Local optimal = global optimal | Greedy | 10 |
| Shortest path / connected components | Graph | 11 |
| Dynamic connectivity / merge groups | Union-Find | 12 |
| Dependency ordering | Topological Sort | 13 |
| Prefix matching / autocomplete | Trie | 14 |
| Range query + updates | Segment Tree | 15 |
| Prefix sum + updates (simpler) | Fenwick Tree | 16 |
| XOR tricks / subset enum | Bit Manipulation | 17 |
| Split, solve halves, combine | Divide & Conquer | 18 |
| Bitmask/interval/digit state | Advanced DP | 19 |
| Weighted shortest path / MST | Advanced Graph | 20 |
n ≤ 10 → O(n!) or O(2^n) → Brute force / backtracking
n ≤ 20 → O(2^n) → Bitmask DP / meet in middle
n ≤ 100 → O(n^3) → Floyd-Warshall / cubic DP
n ≤ 1,000 → O(n^2) → Nested loops / 2D DP
n ≤ 100,000 → O(n log n) → Sorting / segment tree
n ≤ 1,000,000 → O(n) → Hash map / two pointers
n ≤ 10^12 → O(log n) → Binary search / math
- Start with
docs/— Read all four foundation documents - Work through
patterns/sequentially — Each pattern builds on previous ones - For each pattern:
- Read
concept.mdfor theory - Study
visual.mdfor diagrams - Solve problems in
problems.md - Study implementations in
csharp/andtypescript/
- Read
- Practice with
practice/— Start easy, progress to hard - Review regularly — Revisit patterns you find difficult
All implementations are provided in:
- C# — Using modern C# (.NET 6+) idioms
- TypeScript — Using strict TypeScript with proper typing
Both languages are interview-ready and cover the same algorithms with language-appropriate patterns.
Built for engineers who refuse to leave algorithm performance to chance.