Skip to content

🧠 Algorithms & Data Structures Core

Nền tảng Thuật toán & Cấu trúc Dữ liệu — Production-Grade

Bộ tài liệu thuật toán production-grade duy nhất tại Việt Nam kèm invariant proofs, test design, và interview framework chuẩn FAANG. Không chỉ "giải bài" — mà hiểu tại sao giải pháp đúng, và chứng minh được nó đúng.

ModulesLessonsDuration
127850–70 giờ

📋 Overview

Learning Outcomes

  • ✅ Phân tích time & space complexity cho mọi algorithm production-grade
  • ✅ Implement chuẩn: arrays, hash maps, trees, graphs, heaps, tries
  • ✅ Giải Dynamic Programming từ 1D → 2D → optimization, kèm state transition proof
  • ✅ Áp dụng advanced structures: segment trees, disjoint sets, Fenwick trees
  • ✅ Thiết kế test cases phủ edge cases cho mọi bài toán
  • ✅ Xây dựng interview problem-solving framework có cấu trúc
  • ✅ Đọc và viết invariant proofs cho correctness verification

Prerequisites

  • Nắm vững ít nhất 1 ngôn ngữ lập trình (Python/C++/Java)
  • Hiểu cơ bản về loops, conditionals, functions
  • Biết khái niệm Big-O ở mức introductory
  • Có khả năng đọc và viết pseudocode

🗺️ Suggested Roadmaps


📚 Curriculum Tree

⚠️ Curriculum Index Preview: Đây là bản preview cấu trúc curriculum — hiển thị danh sách module, lesson titles, và exercise types. Nội dung bài học đầy đủ (lecture notes, code examples, exercises có lời giải) nằm trong Premium Pack.

bundle-algo-ds--mod-01: Complexity Analysis & Mathematical Foundations (7 lessons)
Asymptotic Notation: Big-O, Big-Θ, Big-Ω

Phân biệt chính xác ba ký hiệu asymptotic và tránh những sai lầm phổ biến khi đánh giá độ phức tạp.

Objectives:

  • Master formal definitions of Big-O, Big-Θ, Big-Ω với ví dụ toán học
  • Phân tích nested loops và recursive calls bằng substitution
  • Nhận diện common complexity traps trong production code
  • So sánh asymptotic growth rates cho algorithm selection

Prerequisites:

  • Basic algebra và function growth concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Một đoạn code với nested conditions — bạn chọn đúng asymptotic class
  • 🔍 SpotTheBug — Phân tích complexity bị sai ở đâu trong lập luận cho trước

⏱️ ~35 phút · dsa · performance · interview

Amortized Analysis: Aggregate, Accounting & Potential

Ba phương pháp amortized analysis áp dụng cho dynamic arrays, hash tables, và splay trees.

Objectives:

  • Apply aggregate method cho dynamic array resizing sequences
  • Dùng accounting method cho multi-operation cost analysis
  • Derive potential function cho self-adjusting structures
  • So sánh amortized vs worst-case trong system design decisions

Prerequisites:

  • Asymptotic notation fundamentals
  • Basic probability concepts

Exercise Preview:

  • 🧩 Parsons — Sắp xếp các bước chứng minh amortized cost của dynamic array
  • 🎯 ScenarioChoice — Chọn phương pháp amortized analysis phù hợp cho scenario

⏱️ ~45 phút · dsa · performance · production

Recurrence Relations & Master Theorem

Giải recurrence cho divide-and-conquer bằng Master Theorem, Akra-Bazzi, và substitution method.

Objectives:

  • Solve standard recurrences với Master Theorem 3 cases
  • Apply Akra-Bazzi method cho non-standard splits
  • Verify solutions bằng substitution method
  • Map algorithm structure sang recurrence form chính xác

Prerequisites:

  • Asymptotic notation
  • Basic calculus: limits & logarithms

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước giải recurrence T(n) = 2T(n/2) + n log n
  • 🔍 SpotTheBug — Phát hiện sai sót khi áp dụng Master Theorem cho edge case

⏱️ ~40 phút · dsa · interview · performance

Space Complexity & Memory Hierarchy

Phân tích space complexity chính xác bao gồm stack frames, heap allocation, và cache locality.

Objectives:

  • Calculate auxiliary vs total space complexity cho recursive algorithms
  • Analyze call stack depth và tail-call optimization impact
  • Hiểu CPU cache effects lên algorithm performance
  • Design in-place algorithms với O(1) extra space

Prerequisites:

  • Asymptotic notation
  • Basic understanding of call stack and heap

Exercise Preview:

  • 🔍 SpotTheBug — Tìm memory issue trong recursive implementation
  • 🎯 ScenarioChoice — Chọn data layout tối ưu cache cho scenario
  • 🏗️ ArchitectureDragDrop — Xếp các memory tier theo latency và capacity

⏱️ ~40 phút · dsa · performance · production · backend

Probabilistic Analysis & Expected Complexity

Phân tích expected-case performance cho randomized algorithms, hashing, và skip lists.

Objectives:

  • Compute expected running time dùng indicator random variables
  • Phân tích randomized QuickSort expected O(n log n)
  • Hiểu birthday paradox trong hash collision analysis
  • Apply Las Vegas vs Monte Carlo classification

Prerequisites:

  • Asymptotic notation
  • Basic probability: expectation & variance

Exercise Preview:

  • 🎯 ScenarioChoice — Ước lượng expected complexity cho randomized algorithm
  • 🧩 Parsons — Xây dựng probabilistic argument từ indicator variables

⏱️ ~45 phút · dsa · performance · interview

Lower Bounds & Decision Tree Model

Chứng minh comparison-based sorting Ω(n log n) và adversary argument techniques.

Objectives:

  • Prove Ω(n log n) lower bound bằng decision tree model
  • Apply adversary arguments cho search & selection problems
  • Hiểu information-theoretic lower bounds
  • Phân biệt tight bounds vs loose bounds trong practice

Prerequisites:

  • Asymptotic notation
  • Logarithm properties
  • Recurrence relations basics

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước chứng minh comparison-based lower bound
  • 🎯 ScenarioChoice — Xác định tight bound cho bài toán cho trước

⏱️ ~40 phút · dsa · interview · performance

NP-Completeness Primer & Reduction Techniques

Nhận diện NP-complete problems và polynomial reduction trong thực chiến engineering.

Objectives:

  • Classify problems thành P, NP, NP-hard, NP-complete chính xác
  • Thực hiện polynomial-time reductions giữa classic problems
  • Recognize NP-complete patterns trong real-world disguise
  • Chọn approximation và heuristic strategies cho NP-hard instances

Prerequisites:

  • Asymptotic notation
  • Graph fundamentals
  • Decision tree concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Phân loại bài toán vào đúng complexity class
  • 🏗️ ArchitectureDragDrop — Xây dựng chuỗi reduction giữa classic NP-complete problems

⏱️ ~50 phút · dsa · interview · backend

bundle-algo-ds--mod-02: Arrays, Strings & Two-Pointer Techniques (7 lessons)
Array Fundamentals & In-Place Manipulation

Chiến lược xử lý mảng tại chỗ — swap, partition, Dutch National Flag — giảm auxiliary space về O(1).

Objectives:

  • Implement in-place array reversal, rotation, và partitioning
  • Apply Dutch National Flag cho 3-way partitioning
  • Phân tích cache performance của sequential vs random access
  • Handle edge cases: empty array, single element, duplicates

Prerequisites:

  • Basic programming: loops, indexing

Exercise Preview:

  • 🔍 SpotTheBug — Tìm off-by-one error trong in-place rotation
  • 🧩 Parsons — Sắp xếp bước thực hiện Dutch National Flag partition

⏱️ ~30 phút · dsa · interview · performance

Two Pointers: Converging & Diverging Patterns

Pattern matching hai con trỏ cho sorted arrays, palindromes, và container problems.

Objectives:

  • Apply converging pointers cho two-sum on sorted array
  • Implement diverging pointers cho palindrome verification
  • Nhận diện khi two-pointer applicable vs khi không
  • Optimize brute-force O(n²) xuống O(n) với pointer technique

Prerequisites:

  • Array fundamentals
  • Sorting basics

Exercise Preview:

  • 🧩 Parsons — Xây dựng two-pointer solution step by step
  • 🎯 ScenarioChoice — Chọn đúng pointer strategy cho từng problem pattern

⏱️ ~35 phút · dsa · interview · performance

Sliding Window: Fixed-Size & Variable-Size

Template sliding window cho substring problems, maximum sum subarrays, và stream processing.

Objectives:

  • Implement fixed-size window cho moving average và max sum
  • Apply variable-size window cho longest substring without repeat
  • Recognize window shrink conditions chính xác
  • Handle edge cases: window larger than array, all duplicates

Prerequisites:

  • Two-pointer fundamentals
  • Hash map basics

Exercise Preview:

  • 🧩 Parsons — Xây dựng variable-size sliding window template
  • 🔍 SpotTheBug — Phát hiện window boundary error trong implementation
  • 🎯 ScenarioChoice — Chọn fixed vs variable window cho problem statement

⏱️ ~40 phút · dsa · interview · performance

Prefix Sum & Difference Arrays

Range query O(1) với prefix sum, 2D prefix sum, và difference arrays cho range update.

Objectives:

  • Build 1D prefix sum cho O(1) range queries
  • Extend to 2D prefix sum cho submatrix sum queries
  • Apply difference arrays cho batch range updates
  • Combine prefix sum với hash map cho subarray sum equals K

Prerequisites:

  • Array fundamentals
  • Basic arithmetic

Exercise Preview:

  • 🧩 Parsons — Xây dựng 2D prefix sum step by step
  • 🔍 SpotTheBug — Tìm index error trong difference array application
  • 🎯 ScenarioChoice — Chọn technique phù hợp cho range query pattern

⏱️ ~35 phút · dsa · interview · performance

Kadane's Algorithm & Maximum Subarray Variants

Maximum subarray sum, circular variant, maximum product, và k-concatenation extension.

Objectives:

  • Prove correctness của Kadane's algorithm bằng invariant
  • Extend Kadane's cho circular array variant
  • Handle maximum product subarray với negative numbers
  • Apply divide-and-conquer alternative và so sánh trade-offs

Prerequisites:

  • Array fundamentals
  • Prefix sum concepts

Exercise Preview:

  • 🔍 SpotTheBug — Phát hiện bug khi handle all-negative array
  • 🎯 ScenarioChoice — Chọn variant phù hợp cho business requirement

⏱️ ~35 phút · dsa · interview · performance

String Manipulation & Encoding Strategies

String reversal, anagram detection, run-length encoding, và Unicode-aware processing.

Objectives:

  • Implement efficient string reversal cho immutable string types
  • Design anagram detection với frequency counting
  • Apply run-length encoding cho compression scenarios
  • Handle Unicode multi-byte characters trong string operations

Prerequisites:

  • Array fundamentals
  • Hash map basics

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước encode/decode run-length string
  • 🔍 SpotTheBug — Tìm encoding bug với multi-byte character input

⏱️ ~35 phút · dsa · backend · production

Matrix Traversal & Spiral Order Patterns

Spiral matrix, diagonal traversal, rotate 90°, và search in sorted matrix.

Objectives:

  • Implement spiral order traversal không dùng visited array
  • Rotate matrix 90° clockwise in-place
  • Apply binary search trên row-sorted & fully-sorted matrix
  • Handle rectangular matrix edge cases

Prerequisites:

  • Array fundamentals
  • Two-pointer concepts

Exercise Preview:

  • 🧩 Parsons — Xây dựng boundary-shrink spiral traversal
  • 🔍 SpotTheBug — Tìm boundary error trong matrix rotation
  • 🏗️ ArchitectureDragDrop — Sắp xếp traversal order cho matrix patterns

⏱️ ~35 phút · dsa · interview · performance

bundle-algo-ds--mod-03: Hashing & Hash-Based Structures (6 lessons)
Hash Function Design & Collision Resolution

Thiết kế hash function tốt, phân tích collision probability, và chọn resolution strategy phù hợp.

Objectives:

  • Evaluate hash function quality: uniformity, avalanche effect, speed
  • Implement chaining vs open addressing với performance trade-offs
  • Analyze load factor impact lên expected lookup time
  • Design custom hash cho composite keys trong production

Prerequisites:

  • Array fundamentals
  • Basic probability

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn collision resolution strategy cho use case cụ thể
  • 🔍 SpotTheBug — Phát hiện hash function yếu gây clustering

⏱️ ~40 phút · dsa · backend · performance

Hash Map Internals: Resizing, Probing & Robin Hood

Deep dive vào hash map implementation: linear probing, quadratic probing, Robin Hood hashing, và dynamic resizing.

Objectives:

  • Implement linear probing với tombstone deletion handling
  • Compare quadratic probing vs double hashing performance
  • Hiểu Robin Hood hashing variance reduction
  • Design resize strategy: load factor thresholds và amortized cost

Prerequisites:

  • Hash function design
  • Amortized analysis basics

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước Robin Hood insertion
  • 🔍 SpotTheBug — Tìm bug trong probing sequence khi table gần đầy
  • 🏗️ ArchitectureDragDrop — Thiết kế hash map resizing pipeline

⏱️ ~45 phút · dsa · backend · performance · production

Frequency Counting & Two-Sum Pattern Family

Hash map patterns cho frequency counting, two-sum, group anagrams, và subarray sum problems.

Objectives:

  • Implement O(n) two-sum với hash map lookup
  • Extend to three-sum, four-sum, và k-sum generalization
  • Apply frequency map cho group anagrams và duplicate detection
  • Combine hash map + prefix sum cho subarray sum equals target

Prerequisites:

  • Hash map fundamentals

Exercise Preview:

  • 🧩 Parsons — Xây dựng k-sum solution từ two-sum building block
  • 🎯 ScenarioChoice — Chọn hash strategy cho different constraint sets

⏱️ ~35 phút · dsa · interview · performance

Rolling Hash & Rabin-Karp String Matching

Rolling hash polynomial, Rabin-Karp cho single/multiple pattern matching, và plagiarism detection.

Objectives:

  • Implement polynomial rolling hash với modular arithmetic
  • Apply Rabin-Karp cho single pattern O(n+m) expected time
  • Extend to multi-pattern matching với hash set
  • Handle hash collision false positives gracefully

Prerequisites:

  • Hash function fundamentals
  • String basics
  • Modular arithmetic

Exercise Preview:

  • 🧩 Parsons — Xây dựng rolling hash update step by step
  • 🔍 SpotTheBug — Phát hiện integer overflow trong polynomial hash

⏱️ ~40 phút · dsa · interview · backend

Bloom Filters & Count-Min Sketch

Probabilistic data structures cho membership testing và frequency estimation ở production scale.

Objectives:

  • Design Bloom filter với optimal number of hash functions
  • Calculate false positive rate cho given parameters
  • Implement Count-Min Sketch cho stream frequency estimation
  • Áp dụng trong real systems: cache warming, URL shortener, analytics

Prerequisites:

  • Hash function design
  • Basic probability

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn parameters cho Bloom filter dựa trên FPR requirement
  • 🏗️ ArchitectureDragDrop — Thiết kế data pipeline với probabilistic structures

⏱️ ~45 phút · dsa · production · backend · performance

Consistent Hashing & Distributed Hash Tables

Consistent hashing cho load balancing, virtual nodes, và jump consistent hash trong distributed systems.

Objectives:

  • Implement consistent hashing ring với virtual nodes
  • Analyze load distribution uniformity với different vnode counts
  • Compare rendezvous hashing vs consistent hashing trade-offs
  • Apply trong real scenarios: CDN routing, database sharding

Prerequisites:

  • Hash fundamentals
  • Distributed systems concepts

Exercise Preview:

  • 🏗️ ArchitectureDragDrop — Thiết kế consistent hashing ring cho service mesh
  • 🎯 ScenarioChoice — Chọn hashing strategy cho distributed storage scenario

⏱️ ~50 phút · dsa · backend · production · performance

bundle-algo-ds--mod-04: Linked Lists, Stacks & Queues (6 lessons)
Singly & Doubly Linked Lists: Pointer Surgery

Master pointer manipulation — insert, delete, reverse — với attention to edge cases và memory safety.

Objectives:

  • Implement singly linked list CRUD operations robustly
  • Reverse linked list iteratively và recursively
  • Handle edge cases: empty list, single node, circular
  • Analyze trade-offs vs array-based alternatives

Prerequisites:

  • Basic pointer/reference concepts

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước reverse doubly linked list in-place
  • 🔍 SpotTheBug — Tìm dangling pointer bug trong deletion operation

⏱️ ~30 phút · dsa · interview · performance

Fast-Slow Pointer & Cycle Detection

Floyd's tortoise-and-hare cho cycle detection, finding cycle start, và happy number pattern.

Objectives:

  • Prove Floyd's algorithm correctness với mathematical argument
  • Find cycle entry point sau detection phase
  • Apply fast-slow pointer cho linked list middle finding
  • Extend pattern sang array-based cycle detection (find duplicate)

Prerequisites:

  • Linked list fundamentals

Exercise Preview:

  • 🧩 Parsons — Xây dựng two-phase cycle detection + entry finding
  • 🎯 ScenarioChoice — Chọn detection algorithm cho constraint set
  • 🔍 SpotTheBug — Phát hiện off-by-one trong cycle length calculation

⏱️ ~35 phút · dsa · interview · performance

Stack-Based Algorithms: Monotonic Stack & Applications

Monotonic stack cho next greater element, largest rectangle, và expression evaluation.

Objectives:

  • Implement monotonic increasing/decreasing stack template
  • Solve next greater element in O(n) với stack
  • Apply cho largest rectangle in histogram
  • Evaluate arithmetic expressions với operator precedence stack

Prerequisites:

  • Array fundamentals
  • Stack ADT basics

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước monotonic stack cho largest rectangle
  • 🔍 SpotTheBug — Tìm stack underflow bug trong expression evaluator
  • 🎯 ScenarioChoice — Chọn increasing vs decreasing stack cho problem

⏱️ ~40 phút · dsa · interview · backend

Queue, Deque & Sliding Window Maximum

Monotonic deque cho sliding window maximum, BFS queue patterns, và circular buffer.

Objectives:

  • Implement sliding window maximum O(n) với monotonic deque
  • Design circular buffer với O(1) enqueue/dequeue
  • Apply deque cho stock span và daily temperatures problems
  • Compare deque implementations: array-based vs linked

Prerequisites:

  • Array fundamentals
  • Queue ADT basics

Exercise Preview:

  • 🧩 Parsons — Xây dựng monotonic deque maintain step by step
  • 🔍 SpotTheBug — Tìm deque boundary error trong circular buffer

⏱️ ~35 phút · dsa · interview · performance

LRU Cache: Linked HashMap Design

Thiết kế LRU Cache O(1) get/put với doubly linked list + hash map combination.

Objectives:

  • Design LRU cache interface và invariant specification
  • Implement O(1) get/put với ordered hash map
  • Handle eviction policy và capacity management
  • Extend to LFU cache variant và compare trade-offs

Prerequisites:

  • Linked list manipulation
  • Hash map fundamentals

Exercise Preview:

  • 🏗️ ArchitectureDragDrop — Thiết kế internal data flow của LRU cache
  • 🎯 ScenarioChoice — Chọn eviction policy cho caching scenario
  • 🔍 SpotTheBug — Phát hiện race condition tiềm ẩn trong cache design

⏱️ ~45 phút · dsa · backend · production · interview

Skip Lists: Probabilistic Balanced Search

Skip list design, expected O(log n) search, và so sánh với balanced BST trong practice.

Objectives:

  • Implement skip list insertion với randomized level generation
  • Prove expected O(log n) search time bằng probabilistic analysis
  • Compare skip list vs Red-Black tree: implementation complexity vs performance
  • Apply trong concurrent data structures (lock-free skip list overview)

Prerequisites:

  • Linked list fundamentals
  • Probability basics

Exercise Preview:

  • 🧩 Parsons — Xây dựng skip list insertion với level generation
  • 🎯 ScenarioChoice — Chọn skip list vs BST cho concurrency requirement

⏱️ ~40 phút · dsa · production · performance

bundle-algo-ds--mod-05: Trees & Binary Search Trees (7 lessons)
Binary Tree Traversals & Reconstruction

Inorder, preorder, postorder, level-order traversals và reconstruct tree từ traversal pairs.

Objectives:

  • Implement all 4 traversal orders iteratively và recursively
  • Reconstruct binary tree từ inorder + preorder/postorder
  • Serialize/deserialize binary tree cho distributed systems
  • Analyze space complexity của recursive vs iterative approaches

Prerequisites:

  • Basic recursion
  • Stack/Queue ADT

Exercise Preview:

  • 🧩 Parsons — Xây dựng iterative inorder traversal với explicit stack
  • 🔍 SpotTheBug — Phát hiện bug trong tree reconstruction từ traversals
  • 🎯 ScenarioChoice — Chọn traversal order phù hợp cho use case

⏱️ ~40 phút · dsa · interview · backend

BST Invariants & Core Operations

Insert, delete, search, predecessor/successor với BST invariant preservation proof.

Objectives:

  • Implement BST insert, delete (3 cases), search O(h)
  • Find in-order predecessor và successor efficiently
  • Prove BST invariant preservation sau mỗi operation
  • Analyze worst-case O(n) khi BST degenerates

Prerequisites:

  • Binary tree basics
  • Recursion

Exercise Preview:

  • 🔍 SpotTheBug — Tìm invariant violation trong BST deletion
  • 🧩 Parsons — Sắp xếp bước delete node với 2 children

⏱️ ~35 phút · dsa · interview · performance

AVL Trees: Rotations & Height Balance Proof

Single/double rotations, height-balanced invariant, và proof of O(log n) guarantee.

Objectives:

  • Implement 4 rotation cases: LL, RR, LR, RL
  • Prove height ≤ 1.44 log₂(n+2) bằng Fibonacci argument
  • Analyze insertion và deletion rebalancing cost
  • Compare AVL vs Red-Black tree practical performance

Prerequisites:

  • BST operations
  • Mathematical proof basics

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước LR double rotation
  • 🔍 SpotTheBug — Phát hiện balance factor update error sau rotation
  • 🎯 ScenarioChoice — Chọn AVL vs Red-Black cho workload pattern

⏱️ ~45 phút · dsa · interview · performance

Red-Black Trees: Coloring Invariants & Industry Usage

5 Red-Black properties, insertion fixup, deletion fixup, và tại sao Java TreeMap chọn RB-tree.

Objectives:

  • State 5 Red-Black invariants và prove black-height balance
  • Implement insertion fixup với 3 uncle-color cases
  • Understand deletion fixup double-black resolution
  • Analyze amortized rotation count: O(1) per insert

Prerequisites:

  • BST operations
  • AVL tree concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Xác định fixup case cho insertion scenario
  • 🏗️ ArchitectureDragDrop — Trace insertion fixup từ violation đến resolved state

⏱️ ~50 phút · dsa · production · backend

B-Trees & B+ Trees: Disk-Optimized Search

Multi-way search trees cho database indexing — node structure, split/merge, và I/O complexity.

Objectives:

  • Design B-tree node structure cho disk page alignment
  • Implement search, insert with split, delete with merge
  • Analyze I/O complexity O(logₜ n) với branching factor t
  • Compare B-tree vs B+ tree cho range query performance

Prerequisites:

  • BST concepts
  • Basic disk I/O understanding

Exercise Preview:

  • 🏗️ ArchitectureDragDrop — Thiết kế B+ tree index cho database use case
  • 🎯 ScenarioChoice — Chọn branching factor dựa trên page size constraint
  • 🔍 SpotTheBug — Phát hiện split propagation error

⏱️ ~50 phút · dsa · backend · production · performance

Trie & Compressed Trie (Patricia/Radix)

Prefix tree cho autocomplete, IP routing, dictionary lookup, và memory-efficient Patricia trie.

Objectives:

  • Implement basic trie với insert, search, startsWith operations
  • Compress trie thành Patricia/Radix trie cho memory efficiency
  • Apply trie cho autocomplete ranking và wildcard matching
  • Analyze memory trade-offs: trie vs hash map cho string sets

Prerequisites:

  • String basics
  • Tree traversal concepts

Exercise Preview:

  • 🧩 Parsons — Xây dựng trie insertion và prefix search
  • 🎯 ScenarioChoice — Chọn trie vs hash set cho specific workload

⏱️ ~40 phút · dsa · backend · production

Lowest Common Ancestor & Tree DP Patterns

LCA algorithms: naive, binary lifting, Euler tour + RMQ, và DP trên cây.

Objectives:

  • Implement LCA với binary lifting O(n log n) preprocessing
  • Apply Euler tour reduction to RMQ
  • Solve tree DP problems: tree diameter, max path sum
  • Handle LCA queries online và offline (Tarjan's offline LCA)

Prerequisites:

  • Tree traversals
  • Recursion
  • Sparse table concepts

Exercise Preview:

  • 🧩 Parsons — Xây dựng binary lifting preprocessing table
  • 🔍 SpotTheBug — Phát hiện depth calculation error trong LCA query
  • 🎯 ScenarioChoice — Chọn LCA algorithm dựa trên query pattern

⏱️ ~50 phút · dsa · interview · performance

bundle-algo-ds--mod-06: Heaps & Priority Queues (5 lessons)
Binary Heap: Build, Insert, Extract & Heapify

Max-heap, min-heap internals — array representation, sift-up/down, và O(n) build proof.

Objectives:

  • Implement binary heap với array-based storage
  • Prove O(n) build-heap complexity bằng summation argument
  • Analyze sift-up vs sift-down performance characteristics
  • Handle heap property restoration sau arbitrary modification

Prerequisites:

  • Array fundamentals
  • Complete binary tree concepts

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước build-heap từ unordered array
  • 🔍 SpotTheBug — Tìm sift-down boundary error trong extract-max

⏱️ ~35 phút · dsa · interview · performance

Heap Applications: Top-K, Running Median & Task Scheduler

Priority queue patterns cho top-K elements, dual-heap median, và task scheduling.

Objectives:

  • Solve top-K elements với min-heap of size K
  • Maintain running median với dual-heap (max-heap + min-heap)
  • Design task scheduler với priority queue + cooldown
  • Apply heap cho merge K sorted lists efficiently

Prerequisites:

  • Binary heap operations

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn min-heap vs max-heap cho specific K-selection problem
  • 🧩 Parsons — Xây dựng dual-heap rebalancing cho running median
  • 🔍 SpotTheBug — Phát hiện heap size invariant violation

⏱️ ~40 phút · dsa · interview · backend

D-ary Heaps & Performance Tuning

D-ary heap cho different insert/extract ratios và cache-friendly heap design.

Objectives:

  • Analyze d-ary heap: O(d logd n) extract vs O(logd n) insert
  • Choose optimal d cho Dijkstra-like workloads
  • Implement cache-friendly heap layout techniques
  • Compare binary vs 4-ary heap benchmark results

Prerequisites:

  • Binary heap fundamentals
  • Cache hierarchy concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn branching factor d cho workload pattern
  • 🏗️ ArchitectureDragDrop — Thiết kế heap memory layout cho cache optimization

⏱️ ~40 phút · dsa · performance · production

Priority Queue in Graph Algorithms

Priority queue integration với Dijkstra, Prim, Huffman — interface design và implementation choices.

Objectives:

  • Implement decrease-key cho indexed priority queue
  • Analyze Dijkstra performance với binary heap vs Fibonacci heap
  • Apply priority queue cho Huffman encoding tree construction
  • Design priority queue interface cho extensibility

Prerequisites:

  • Binary heap
  • Graph basics
  • Greedy concepts

Exercise Preview:

  • 🧩 Parsons — Sắp xếp Dijkstra relaxation steps với priority queue
  • 🎯 ScenarioChoice — Chọn priority queue implementation cho graph density

⏱️ ~40 phút · dsa · interview · backend

Merge K Sorted Streams & External Sorting

K-way merge với min-heap cho sorted streams, external sort, và distributed merge.

Objectives:

  • Implement K-way merge in O(N log K) với min-heap
  • Design external sort cho data larger than memory
  • Apply tournament tree variant cho comparison reduction
  • Handle fault tolerance trong distributed merge scenarios

Prerequisites:

  • Binary heap
  • I/O complexity basics

Exercise Preview:

  • 🏗️ ArchitectureDragDrop — Thiết kế external sort pipeline end-to-end
  • 🎯 ScenarioChoice — Chọn merge strategy cho memory constraint

⏱️ ~45 phút · dsa · backend · production · performance

bundle-algo-ds--mod-07: Graphs: Traversal & Connectivity (7 lessons)
Graph Representations & Trade-off Analysis

Adjacency matrix, adjacency list, edge list, implicit graphs — chọn representation đúng cho problem.

Objectives:

  • Implement adjacency list và adjacency matrix representations
  • Analyze space/time trade-offs: dense vs sparse graphs
  • Recognize implicit graphs (state-space, grid-based)
  • Design graph API cho extensibility và type safety

Prerequisites:

  • Basic data structures
  • Object-oriented concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn graph representation cho density constraint
  • 🏗️ ArchitectureDragDrop — Thiết kế graph class hierarchy cho production

⏱️ ~30 phút · dsa · backend · production

BFS: Level-Order Traversal & Shortest Path in Unweighted Graphs

BFS template, multi-source BFS, 0-1 BFS, và shortest path extraction.

Objectives:

  • Implement BFS với visited set và distance tracking
  • Solve multi-source BFS: rotting oranges, nearest gate
  • Apply 0-1 BFS với deque cho {0,1}-weighted edges
  • Reconstruct shortest path từ BFS parent tracking

Prerequisites:

  • Graph representation
  • Queue ADT

Exercise Preview:

  • 🧩 Parsons — Xây dựng multi-source BFS initialization
  • 🔍 SpotTheBug — Phát hiện visited-check timing error trong BFS

⏱️ ~35 phút · dsa · interview · performance

DFS: Backtracking, Cycle Detection & Component Analysis

DFS template, pre/post ordering, back-edge detection, và connected component counting.

Objectives:

  • Implement recursive và iterative DFS với state tracking
  • Detect cycles bằng back-edge classification
  • Count connected components trong undirected graphs
  • Apply DFS cho maze solving và flood fill

Prerequisites:

  • Graph representation
  • Stack/recursion concepts

Exercise Preview:

  • 🧩 Parsons — Sắp xếp DFS edge classification logic
  • 🔍 SpotTheBug — Tìm cycle detection false positive trong directed graph
  • 🎯 ScenarioChoice — Chọn BFS vs DFS cho specific search requirement

⏱️ ~35 phút · dsa · interview · performance

Topological Sort: Kahn's Algorithm & DFS-Based

Topological ordering cho DAGs — build system dependencies, course scheduling, task orchestration.

Objectives:

  • Implement Kahn's algorithm (BFS-based) với in-degree tracking
  • Implement DFS-based topological sort với finish-time ordering
  • Detect cycles trong directed graph qua topological sort failure
  • Apply cho real scenarios: build systems, data pipelines

Prerequisites:

  • BFS
  • DFS
  • DAG concept

Exercise Preview:

  • 🧩 Parsons — Xây dựng Kahn's algorithm step by step
  • 🎯 ScenarioChoice — Chọn topological sort variant cho specific constraint
  • 🏗️ ArchitectureDragDrop — Sắp xếp task dependency graph thành valid execution order

⏱️ ~40 phút · dsa · interview · backend · production

Strongly Connected Components: Tarjan & Kosaraju

SCC decomposition cho directed graphs — condensation DAG, 2-SAT, và dependency analysis.

Objectives:

  • Implement Tarjan's SCC algorithm với low-link values
  • Implement Kosaraju's two-pass DFS approach
  • Build condensation DAG từ SCC decomposition
  • Apply SCC cho dependency cycle detection trong real systems

Prerequisites:

  • DFS edge classification
  • Stack operations

Exercise Preview:

  • 🧩 Parsons — Xây dựng Tarjan's algorithm với low-link tracking
  • 🔍 SpotTheBug — Phát hiện stack management error trong SCC extraction

⏱️ ~45 phút · dsa · interview · backend

Articulation Points & Bridges: Network Reliability

Cut vertices và bridges cho network failure analysis — Tarjan's variant cho biconnected components.

Objectives:

  • Implement articulation point detection O(V+E)
  • Find bridges (cut edges) bằng modified DFS
  • Decompose graph thành biconnected components
  • Apply cho network reliability và infrastructure redundancy analysis

Prerequisites:

  • DFS
  • Low-link values concept

Exercise Preview:

  • 🎯 ScenarioChoice — Xác định critical failure points trong network topology
  • 🔍 SpotTheBug — Tìm root special-case bug trong articulation point detection

⏱️ ~40 phút · dsa · production · backend

Bipartite Check, Graph Coloring & Matching Intro

2-coloring cho bipartite verification, chromatic number concepts, và maximum bipartite matching overview.

Objectives:

  • Implement bipartite check bằng BFS 2-coloring
  • Understand graph coloring complexity (NP-hard general case)
  • Apply bipartite matching cho assignment problems
  • Recognize bipartite structure trong practical problems

Prerequisites:

  • BFS
  • DFS
  • Basic graph properties

Exercise Preview:

  • 🎯 ScenarioChoice — Xác định bipartite applicability cho problem structure
  • 🧩 Parsons — Xây dựng BFS 2-coloring verification

⏱️ ~35 phút · dsa · interview · performance

bundle-algo-ds--mod-08: Graphs: Shortest Paths & Minimum Spanning Trees (6 lessons)
Dijkstra's Algorithm: Priority Queue Optimization

Single-source shortest path cho non-negative weights — lazy vs indexed priority queue variants.

Objectives:

  • Implement Dijkstra's với binary heap priority queue
  • Analyze time complexity O((V+E) log V) derivation
  • Handle negative-weight edge trap (why Dijkstra fails)
  • Optimize cho sparse vs dense graphs

Prerequisites:

  • Graph traversal
  • Priority queue
  • Non-negative weights assumption

Exercise Preview:

  • 🧩 Parsons — Sắp xếp Dijkstra relaxation và priority queue operations
  • 🔍 SpotTheBug — Phát hiện bug khi process already-finalized vertex
  • 🎯 ScenarioChoice — Chọn Dijkstra variant cho graph density

⏱️ ~45 phút · dsa · interview · performance

Bellman-Ford & Negative Weight Handling

Bellman-Ford cho graphs có negative weights, negative cycle detection, và SPFA optimization.

Objectives:

  • Implement Bellman-Ford V-1 relaxation passes
  • Detect negative weight cycles bằng V-th pass check
  • Optimize average case với SPFA (Shortest Path Faster Algorithm)
  • Apply cho currency arbitrage detection scenario

Prerequisites:

  • Dijkstra's algorithm concepts
  • Graph relaxation

Exercise Preview:

  • 🧩 Parsons — Trace Bellman-Ford relaxation order
  • 🔍 SpotTheBug — Phát hiện negative cycle detection off-by-one
  • 🎯 ScenarioChoice — Chọn Dijkstra vs Bellman-Ford cho edge weight profile

⏱️ ~40 phút · dsa · interview · backend

Floyd-Warshall: All-Pairs Shortest Paths

Dynamic programming approach cho all-pairs shortest paths — path reconstruction và transitive closure.

Objectives:

  • Implement Floyd-Warshall O(V³) với path matrix
  • Reconstruct actual shortest path từ DP table
  • Detect negative cycles bằng diagonal check
  • Apply cho small dense graphs: routing tables, network latency matrix

Prerequisites:

  • Basic DP concepts
  • Graph representation

Exercise Preview:

  • 🧩 Parsons — Xây dựng Floyd-Warshall triple-loop với correct ordering
  • 🔍 SpotTheBug — Tìm initialization error trong distance matrix

⏱️ ~35 phút · dsa · interview · backend

A* Search & Heuristic Admissibility

A cho informed search — heuristic design, admissibility proof, và game/pathfinding applications.*

Objectives:

  • Implement A* với f(n) = g(n) + h(n) framework
  • Design admissible heuristics: Manhattan, Euclidean, Chebyshev
  • Prove A* optimality khi heuristic admissible và consistent
  • Apply cho grid pathfinding và game AI

Prerequisites:

  • Dijkstra's algorithm
  • Priority queue
  • Heuristic concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn heuristic function cho specific search domain
  • 🏗️ ArchitectureDragDrop — Thiết kế A* search pipeline với open/closed sets
  • 🔍 SpotTheBug — Phát hiện inadmissible heuristic gây non-optimal path

⏱️ ~45 phút · dsa · interview · backend · performance

Kruskal & Prim: Minimum Spanning Tree Algorithms

MST algorithms với cut property proof — Kruskal's sort + union-find vs Prim's priority queue.

Objectives:

  • Implement Kruskal's MST với Union-Find O(E log E)
  • Implement Prim's MST với priority queue O(E log V)
  • Prove MST correctness bằng cut property
  • Compare performance cho sparse vs dense graphs

Prerequisites:

  • Graph basics
  • Union-Find
  • Priority queue

Exercise Preview:

  • 🧩 Parsons — Sắp xếp Kruskal's edge processing steps
  • 🎯 ScenarioChoice — Chọn Kruskal vs Prim dựa trên graph density

⏱️ ~35 phút · dsa · interview · performance

Union-Find: Path Compression, Union by Rank & Applications

Disjoint Set Union (DSU) với near-O(1) amortized — dynamic connectivity, Kruskal integration.

Objectives:

  • Implement Union-Find với path compression + union by rank
  • Prove amortized O(α(n)) inverse Ackermann complexity
  • Apply cho dynamic connectivity queries
  • Extend cho weighted Union-Find (checking edge consistency)

Prerequisites:

  • Basic tree concepts
  • Amortized analysis

Exercise Preview:

  • 🧩 Parsons — Xây dựng path compression recursion
  • 🔍 SpotTheBug — Phát hiện rank update bug trong union operation
  • 🎯 ScenarioChoice — Chọn Union-Find variant cho problem constraints

⏱️ ~40 phút · dsa · interview · production

bundle-algo-ds--mod-09: Dynamic Programming (8 lessons)
DP Fundamentals: Overlapping Subproblems & Optimal Substructure

Framework nhận diện DP problems — state definition, transition, base case, và memoization vs tabulation.

Objectives:

  • Identify overlapping subproblems và optimal substructure properties
  • Convert recursive brute-force sang memoized solution
  • Transform top-down memoization thành bottom-up tabulation
  • Design state representation cho DP problems systematically

Prerequisites:

  • Recursion fundamentals
  • Basic complexity analysis

Exercise Preview:

  • 🎯 ScenarioChoice — Xác định problem có DP-applicable structure hay không
  • 🧩 Parsons — Xây dựng state transition từ recurrence relation

⏱️ ~40 phút · dsa · interview · performance

1D DP: Fibonacci, Climbing Stairs & House Robber

DP trên dãy một chiều — state compression, circular variant, và follow-up extensions.

Objectives:

  • Solve Fibonacci variants với O(n) time, O(1) space
  • Apply DP cho climbing stairs với variable step sizes
  • Handle circular constraint trong House Robber II
  • Recognize 1D DP pattern trong disguised problems

Prerequisites:

  • DP fundamentals: state, transition, base case

Exercise Preview:

  • 🧩 Parsons — Xây dựng space-optimized 1D DP solution
  • 🔍 SpotTheBug — Phát hiện base case initialization error
  • 🎯 ScenarioChoice — Chọn top-down vs bottom-up cho problem size

⏱️ ~30 phút · dsa · interview · performance

2D DP: Grid Paths, LCS & Edit Distance

DP trên lưới 2D và string matching — unique paths, longest common subsequence, Levenshtein distance.

Objectives:

  • Solve unique paths với obstacles trên grid
  • Implement LCS với backtracking path reconstruction
  • Compute edit distance và derive alignment operations
  • Optimize space từ O(mn) xuống O(min(m,n)) với rolling array

Prerequisites:

  • 1D DP patterns
  • String fundamentals

Exercise Preview:

  • 🧩 Parsons — Xây dựng edit distance DP table filling order
  • 🔍 SpotTheBug — Tìm index mapping error trong space-optimized LCS
  • 🎯 ScenarioChoice — Chọn DP formulation cho string alignment variant

⏱️ ~40 phút · dsa · interview · performance

Knapsack Variants: 0/1, Unbounded & Bounded

Knapsack problem family — 0/1, unbounded, bounded, fractional — với optimization techniques.

Objectives:

  • Implement 0/1 knapsack O(nW) bottom-up
  • Solve unbounded knapsack với modified transition
  • Handle bounded knapsack bằng binary representation trick
  • Prove greedy correctness cho fractional knapsack

Prerequisites:

  • 2D DP concepts
  • Basic optimization thinking

Exercise Preview:

  • 🧩 Parsons — Xây dựng 0/1 knapsack bottom-up table
  • 🎯 ScenarioChoice — Map real-world problem sang knapsack variant
  • 🔍 SpotTheBug — Phát hiện iteration order bug trong unbounded variant

⏱️ ~40 phút · dsa · interview · backend

Interval DP & Matrix Chain Multiplication

DP trên intervals — optimal BST, balloon burst, và matrix chain multiplication.

Objectives:

  • Implement matrix chain multiplication O(n³)
  • Solve balloon burst problem với interval DP
  • Design optimal BST construction bằng Knuth's optimization
  • Recognize interval DP pattern trong problems

Prerequisites:

  • 2D DP concepts
  • Recursion trên subproblems

Exercise Preview:

  • 🧩 Parsons — Sắp xếp interval DP filling order: length → left → right
  • 🔍 SpotTheBug — Phát hiện diagonal initialization error

⏱️ ~45 phút · dsa · interview · performance

Bitmask DP: TSP & Assignment Problem

DP với bitmask state — TSP, Hamiltonian path, assignment problem, và subset enumeration.

Objectives:

  • Implement TSP bitmask DP O(2ⁿ · n²)
  • Solve assignment problem với Hungarian-alternative bitmask DP
  • Enumerate subsets of a bitmask efficiently
  • Analyze when bitmask DP feasible (n ≤ 20 guideline)

Prerequisites:

  • Basic DP
  • Bit manipulation fundamentals

Exercise Preview:

  • 🧩 Parsons — Xây dựng bitmask transition cho TSP
  • 🎯 ScenarioChoice — Xác định khi nào bitmask DP applicable dựa trên constraints
  • 🔍 SpotTheBug — Tìm bitmask operation error trong subset enumeration

⏱️ ~50 phút · dsa · interview · performance

State Compression & Space Optimization Techniques

Rolling array, Knuth optimization, divide-and-conquer DP, và Hirschberg's algorithm.

Objectives:

  • Apply rolling array giảm space từ O(n²) xuống O(n)
  • Implement Knuth's optimization cho interval DP O(n²)
  • Hiểu divide-and-conquer DP optimization concept
  • Apply Hirschberg's algorithm cho LCS with O(n) space và path recovery

Prerequisites:

  • 2D DP
  • Interval DP
  • Divide-and-conquer

Exercise Preview:

  • 🧩 Parsons — Xây dựng rolling array transformation step by step
  • 🎯 ScenarioChoice — Chọn optimization technique cho constraint profile
  • 🏗️ ArchitectureDragDrop — Map DP dependencies sang optimized memory layout

⏱️ ~45 phút · dsa · interview · performance

DP on Trees & DAGs

DP trên cấu trúc cây và DAG — tree diameter, rerooting technique, và longest path in DAG.

Objectives:

  • Solve tree diameter bằng two-pass DFS hoặc single-pass DP
  • Apply rerooting technique cho DP answer tại mọi node
  • Compute longest path in DAG bằng topological order DP
  • Handle tree DP với multiple children aggregation

Prerequisites:

  • Tree traversals
  • Topological sort
  • Basic DP

Exercise Preview:

  • 🧩 Parsons — Xây dựng rerooting DP transition
  • 🔍 SpotTheBug — Phát hiện child aggregation error trong tree DP
  • 🎯 ScenarioChoice — Chọn tree DP approach cho specific tree structure

⏱️ ~45 phút · dsa · interview · performance

bundle-algo-ds--mod-10: Greedy Algorithms, Backtracking & Randomization (6 lessons)
Greedy Strategy: Exchange Argument & Matroid Theory

Framework chứng minh greedy correctness — exchange argument, matroid structure, và greedy-choice property.

Objectives:

  • Apply greedy-choice property và optimal substructure verification
  • Prove correctness bằng exchange argument technique
  • Recognize matroid structure cho guaranteed greedy optimality
  • Phân biệt khi greedy works vs khi cần DP

Prerequisites:

  • Basic algorithm analysis
  • DP fundamentals for comparison

Exercise Preview:

  • 🎯 ScenarioChoice — Xác định problem có greedy-choice property hay không
  • 🧩 Parsons — Xây dựng exchange argument proof step by step

⏱️ ~40 phút · dsa · interview · performance

Interval Scheduling & Activity Selection

Greedy cho interval problems — activity selection, meeting rooms, minimum platforms.

Objectives:

  • Prove activity selection greedy optimality
  • Solve meeting rooms II: minimum conference rooms needed
  • Apply sweep line cho overlapping intervals count
  • Handle weighted interval scheduling (DP fallback)

Prerequisites:

  • Greedy fundamentals
  • Sorting

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước greedy activity selection
  • 🔍 SpotTheBug — Phát hiện sorting criterion error cho interval scheduling
  • 🎯 ScenarioChoice — Chọn greedy vs DP cho weighted variant

⏱️ ~35 phút · dsa · interview · backend

Huffman Coding & Optimal Prefix Codes

Huffman tree construction, prefix-free property proof, và application trong data compression.

Objectives:

  • Build Huffman tree với priority queue O(n log n)
  • Prove prefix-free optimality bằng exchange argument
  • Implement encoding/decoding với bit manipulation
  • Compare Huffman vs arithmetic coding trade-offs

Prerequisites:

  • Priority queue
  • Binary tree
  • Greedy fundamentals

Exercise Preview:

  • 🧩 Parsons — Xây dựng Huffman tree từ frequency table
  • 🏗️ ArchitectureDragDrop — Thiết kế compression pipeline end-to-end

⏱️ ~40 phút · dsa · backend · production

Backtracking Framework: N-Queens, Sudoku & Permutations

Systematic backtracking template — constraint propagation, pruning, và solution enumeration.

Objectives:

  • Implement generic backtracking template với choose-explore-unchoose
  • Solve N-Queens với column/diagonal constraint tracking
  • Apply backtracking cho Sudoku solver với constraint propagation
  • Generate permutations và combinations với duplicate handling

Prerequisites:

  • Recursion
  • DFS concepts

Exercise Preview:

  • 🧩 Parsons — Xây dựng N-Queens backtracking với pruning logic
  • 🔍 SpotTheBug — Phát hiện constraint tracking error trong Sudoku solver
  • 🎯 ScenarioChoice — Chọn pruning strategy cho different constraint density

⏱️ ~40 phút · dsa · interview · performance

Branch and Bound: Pruning Strategies for Optimization

Branch-and-bound cho optimization problems — bounding functions, best-first search, và IDA.*

Objectives:

  • Design bounding functions cho pruning decisions
  • Implement best-first branch-and-bound với priority queue
  • Apply IDA* (Iterative Deepening A*) cho memory-constrained search
  • Compare branch-and-bound vs backtracking performance

Prerequisites:

  • Backtracking
  • Priority queue
  • Heuristic concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn bounding function cho optimization problem
  • 🏗️ ArchitectureDragDrop — Thiết kế search tree exploration strategy

⏱️ ~45 phút · dsa · interview · performance

Randomized Algorithms: QuickSelect, Reservoir Sampling & Monte Carlo

Randomization techniques — expected-case improvements, sampling, và probabilistic correctness.

Objectives:

  • Implement randomized QuickSelect O(n) expected
  • Apply reservoir sampling cho streaming K-selection
  • Understand Monte Carlo vs Las Vegas classification
  • Use randomization cho load balancing và hash function design

Prerequisites:

  • Probability basics
  • Array manipulation
  • QuickSort concepts

Exercise Preview:

  • 🧩 Parsons — Xây dựng reservoir sampling invariant step by step
  • 🔍 SpotTheBug — Phát hiện random pivot selection bias
  • 🎯 ScenarioChoice — Chọn deterministic vs randomized approach cho constraint

⏱️ ~40 phút · dsa · interview · production · performance

bundle-algo-ds--mod-11: Sorting, Searching & Selection (6 lessons)
Comparison Sorts: Merge Sort, Quick Sort & Heap Sort

Ba comparison sorts chính — stability, in-place, worst-case guarantees, và production trade-offs.

Objectives:

  • Implement merge sort (stable, O(n log n) guaranteed)
  • Implement quick sort với median-of-three pivot selection
  • Analyze heap sort in-place O(n log n) worst-case
  • Compare practical performance: cache effects, branch prediction

Prerequisites:

  • Array fundamentals
  • Recursion
  • Heap concepts

Exercise Preview:

  • 🧩 Parsons — Xây dựng merge step của merge sort
  • 🎯 ScenarioChoice — Chọn sorting algorithm cho stability + performance constraint
  • 🔍 SpotTheBug — Phát hiện partition boundary error trong quick sort

⏱️ ~40 phút · dsa · interview · performance

Non-Comparison Sorts: Counting, Radix & Bucket

Linear-time sorts cho restricted domains — counting sort stability, LSD vs MSD radix, bucket distribution.

Objectives:

  • Implement stable counting sort O(n + k)
  • Apply LSD radix sort cho integer arrays
  • Design bucket sort cho uniformly distributed data
  • Analyze when linear sorts beat comparison sorts

Prerequisites:

  • Array fundamentals
  • Integer representation basics

Exercise Preview:

  • 🧩 Parsons — Sắp xếp bước LSD radix sort pass by pass
  • 🔍 SpotTheBug — Tìm stability violation trong counting sort implementation
  • 🎯 ScenarioChoice — Chọn sort algorithm dựa trên data distribution profile

⏱️ ~35 phút · dsa · interview · performance

Binary Search Mastery: Templates & Advanced Variants

Binary search templates cho exact match, lower bound, upper bound, và predicate search.

Objectives:

  • Implement 3 binary search templates: exact, lower_bound, upper_bound
  • Apply binary search cho rotated sorted array
  • Solve binary search on answer: minimum maximum, capacity problems
  • Handle floating-point binary search precision issues

Prerequisites:

  • Array fundamentals
  • Sorted data concept

Exercise Preview:

  • 🧩 Parsons — Xây dựng binary search on answer cho allocation problem
  • 🔍 SpotTheBug — Phát hiện infinite loop bug trong boundary condition
  • 🎯 ScenarioChoice — Chọn binary search template variant cho specific predicate

⏱️ ~35 phút · dsa · interview · performance

Quick Select & Order Statistics

K-th smallest/largest element — Quick Select, Median of Medians, và introselect hybrid.

Objectives:

  • Implement randomized Quick Select O(n) expected
  • Understand Median of Medians O(n) worst-case guarantee
  • Design introselect: Quick Select + Median of Medians fallback
  • Apply order statistics cho percentile computation

Prerequisites:

  • Array partitioning
  • Probability basics

Exercise Preview:

  • 🧩 Parsons — Xây dựng Quick Select partition step
  • 🔍 SpotTheBug — Phát hiện pivot selection bias gây worst-case
  • 🎯 ScenarioChoice — Chọn selection algorithm cho latency SLA requirement

⏱️ ~35 phút · dsa · interview · performance

External Sorting & Multi-Way Merge

Sorting datasets larger than memory — replacement selection, polyphase merge, và distributed sort.

Objectives:

  • Design external merge sort pipeline cho TB-scale data
  • Implement replacement selection cho longer initial runs
  • Analyze I/O complexity model cho external algorithms
  • Compare MapReduce sort vs traditional external sort

Prerequisites:

  • Merge sort
  • Heap
  • I/O model basics

Exercise Preview:

  • 🏗️ ArchitectureDragDrop — Thiết kế external sort pipeline với buffer management
  • 🎯 ScenarioChoice — Chọn merge strategy cho disk I/O constraint

⏱️ ~45 phút · dsa · backend · production · performance

Practical Sort Selection & Hybrid Algorithms

Tim Sort, Intro Sort, PDQ Sort — hybrid algorithms trong standard library implementations.

Objectives:

  • Analyze Tim Sort: merge sort + insertion sort + galloping
  • Understand Intro Sort: quick sort + heap sort fallback
  • Evaluate PDQ Sort (Pattern-Defeating Quick Sort) innovations
  • Choose sorting strategy based on data characteristics và constraints

Prerequisites:

  • All comparison sorts
  • Non-comparison sorts

Exercise Preview:

  • 🎯 ScenarioChoice — Chọn sorting strategy cho real-world data profile
  • 🏗️ ArchitectureDragDrop — Map data characteristics sang optimal sort selection

⏱️ ~35 phút · dsa · production · performance

bundle-algo-ds--mod-12: Advanced Data Structures (7 lessons)
Segment Tree: Build, Query & Point Update

Segment tree cho range queries — sum, min, max, GCD — với O(log n) query và update.

Objectives:

  • Implement segment tree build O(n), query O(log n), update O(log n)
  • Apply cho range sum, range min, range GCD queries
  • Handle segment tree memory layout: array-based vs pointer-based
  • Extend cho 2D segment tree concepts

Prerequisites:

  • Array fundamentals
  • Recursion
  • Divide-and-conquer

Exercise Preview:

  • 🧩 Parsons — Xây dựng segment tree build recursion
  • 🔍 SpotTheBug — Phát hiện merge function error cho range query type

⏱️ ~45 phút · dsa · interview · performance

Lazy Propagation: Range Update on Segment Trees

Lazy propagation cho O(log n) range updates — range add, range set, và combined operations.

Objectives:

  • Implement lazy propagation cho range addition
  • Handle range assignment (set) với lazy tag
  • Combine multiple lazy operations correctly
  • Prove correctness: lazy tag invariant preservation

Prerequisites:

  • Segment tree basics

Exercise Preview:

  • 🧩 Parsons — Sắp xếp lazy push-down steps trước query
  • 🔍 SpotTheBug — Phát hiện lazy tag propagation order error
  • 🎯 ScenarioChoice — Chọn lazy strategy cho combined operation types

⏱️ ~50 phút · dsa · interview · performance

Binary Indexed Tree (Fenwick Tree)

Fenwick tree cho prefix sum queries — point update O(log n), prefix query O(log n), và 2D extension.

Objectives:

  • Implement BIT: update và prefix query operations
  • Derive range query từ two prefix queries
  • Extend cho 2D BIT: point update + submatrix sum
  • Compare BIT vs segment tree: code simplicity vs flexibility

Prerequisites:

  • Bit manipulation
  • Prefix sum concepts

Exercise Preview:

  • 🧩 Parsons — Xây dựng BIT update với lowbit navigation
  • 🔍 SpotTheBug — Tìm index offset error (0-based vs 1-based)
  • 🎯 ScenarioChoice — Chọn BIT vs segment tree cho problem requirements

⏱️ ~40 phút · dsa · interview · performance

Sparse Table & Range Minimum Query (RMQ)

Sparse table cho static RMQ O(1) query — preprocessing O(n log n), idempotent function requirement.

Objectives:

  • Build sparse table O(n log n) cho idempotent operations
  • Answer RMQ queries O(1) bằng overlapping blocks
  • Apply cho LCA via Euler tour + RMQ reduction
  • Understand limitation: static data only

Prerequisites:

  • Array fundamentals
  • Logarithm properties

Exercise Preview:

  • 🧩 Parsons — Xây dựng sparse table preprocessing
  • 🔍 SpotTheBug — Phát hiện block overlap error cho non-idempotent operation
  • 🎯 ScenarioChoice — Chọn sparse table vs segment tree cho query pattern

⏱️ ~35 phút · dsa · interview · performance

Persistent Data Structures: Immutable Trees & Versioning

Persistent segment tree, persistent trie — version control cho data structures.

Objectives:

  • Implement persistent segment tree với path copying
  • Analyze space complexity: O(n + q log n) cho q updates
  • Apply cho K-th smallest in range queries
  • Hiểu functional programming connection: immutability benefits

Prerequisites:

  • Segment tree
  • Memory allocation concepts

Exercise Preview:

  • 🎯 ScenarioChoice — Xác định khi nào persistent structure cần thiết
  • 🏗️ ArchitectureDragDrop — Thiết kế version DAG cho persistent structure

⏱️ ~50 phút · dsa · production · performance

Splay Trees: Amortized Self-Adjustment

Splay tree rotations, working set theorem, và sequential access theorem.

Objectives:

  • Implement splay operation: zig, zig-zig, zig-zag
  • Prove O(log n) amortized cost bằng potential method
  • Understand working set property cho locality-of-reference workloads
  • Compare splay tree practical performance vs balanced BSTs

Prerequisites:

  • BST operations
  • Amortized analysis

Exercise Preview:

  • 🧩 Parsons — Sắp xếp splay rotation sequence cho deep access
  • 🔍 SpotTheBug — Phát hiện zig-zig vs zig-zag case selection error

⏱️ ~45 phút · dsa · production · performance

Suffix Array & String Processing at Scale

Suffix array construction, LCP array, và applications cho pattern matching và string analysis.

Objectives:

  • Build suffix array O(n log² n) với comparison sort
  • Construct LCP array O(n) bằng Kasai's algorithm
  • Apply cho number of distinct substrings calculation
  • Compare suffix array vs suffix tree space và time trade-offs

Prerequisites:

  • String fundamentals
  • Sorting
  • Array manipulation

Exercise Preview:

  • 🧩 Parsons — Xây dựng suffix array với rank-based sorting
  • 🎯 ScenarioChoice — Chọn string indexing structure cho query workload
  • 🏗️ ArchitectureDragDrop — Thiết kế text search pipeline với suffix array

⏱️ ~50 phút · dsa · backend · production · performance


📦 What You Get

  • PDF lecture notes (35 bài, full diagrams)
  • Obsidian vault với backlinks & graph view
  • Code templates (Python + C++) cho mỗi data structure
  • Test suites với edge cases mẫu

Lifetime updates: mỗi phiên bản mới gửi qua email đăng ký. Changelog kèm theo mỗi release.


Câu hỏi thường gặp

Quy trình mua hàng như thế nào?

Bạn nhắn tin qua Messenger với bundle muốn mua. Đội ngũ PENALGO sẽ xác nhận đơn hàng, hướng dẫn thanh toán qua chuyển khoản ngân hàng, và gửi link Google Drive chứa tài liệu trong vòng 24 giờ sau khi xác nhận thanh toán.

Tài liệu được giao dưới dạng gì?

Mỗi bundle bao gồm: PDF lecture notes (full diagrams), Obsidian vault (backlinks & graph view), code templates theo ngôn ngữ, và toàn bộ được đóng gói trong Google Drive ZIP. Bạn nhận link tải một lần và sở hữu vĩnh viễn.

Chính sách cập nhật tài liệu ra sao?

Lifetime updates — mỗi phiên bản mới được gửi qua email đăng ký kèm changelog chi tiết. Tối thiểu 2 lần cập nhật mỗi năm cho mỗi bundle, bổ sung case studies mới và cập nhật theo phiên bản công nghệ.

Tôi có thể hoàn tiền không?

Hoàn tiền 100% trong vòng 24 giờ kể từ khi nhận tài liệu, không cần lý do. Sau 24 giờ, do tính chất digital của sản phẩm, chính sách hoàn tiền không còn áp dụng.

Nên mua bundle nào trước?

Tuỳ mục tiêu: Chuẩn bị phỏng vấn → bắt đầu với Algorithms & Data Structures Core. Muốn lên senior → System Design Universe. Chuyển sang DevOps → Docker Masterclass + Infrastructure & DevOps. Xem mục Roadmaps để tìm lộ trình phù hợp nhất với career path của bạn.

Roadmap hoạt động như thế nào?

Mỗi roadmap là một lộ trình học tập được thiết kế cho một mục tiêu nghề nghiệp cụ thể. Roadmap gợi ý thứ tự học các module từ nhiều bundle khác nhau, kèm milestone checkpoints để tự đánh giá tiến độ. Roadmap là hướng dẫn — bạn vẫn cần mua bundle tương ứng để truy cập nội dung.

Curriculum Tree trên web hiển thị gì?

Curriculum Tree là bản preview cấu trúc module/lesson — cho thấy phạm vi và độ sâu của mỗi bundle. Đây là metadata (tiêu đề, mục tiêu, tags), không phải nội dung bài học đầy đủ. Nội dung chi tiết nằm trong Premium Pack khi bạn mua.

Tài liệu có phù hợp với người mới bắt đầu không?

Mỗi bundle ghi rõ prerequisites (yêu cầu đầu vào) — kiểm tra trước khi mua. Đa phần bundle yêu cầu kiến thức nền tảng cơ bản. Nếu bạn đã nắm vững prerequisites, tài liệu sẽ đưa bạn từ intermediate lên production-grade level.

Tôi có thể xem trước nội dung bài học không?

Curriculum Tree trên web cho phép bạn xem danh sách module, lesson titles, mục tiêu, và exercise types. Đây là preview đủ để đánh giá scope và depth. Nội dung bài học đầy đủ (lecture notes, code examples, exercises) chỉ có trong Premium Pack.

Hỗ trợ kỹ thuật khi gặp vấn đề với tài liệu?

Liên hệ qua Messenger hoặc email hỗ trợ. Đội ngũ phản hồi trong vòng 24 giờ (ngày làm việc). Hỗ trợ bao gồm: vấn đề tải file, lỗi format, câu hỏi về nội dung, và gợi ý lộ trình học tập.

Có giảm giá khi mua nhiều bundle không?

Có chính sách combo khi mua từ 3 bundle trở lên. Nhắn tin qua Messenger để nhận báo giá combo phù hợp với mục tiêu học tập của bạn.


💬 Mua ngay

Xin chào! Tôi quan tâm đến bundle "Algorithms & Data Structures Core" (bundle-algo-ds). Tôi muốn biết thêm thông tin và cách mua.

💬 Mua qua Messenger

Nội dung đầy đủ được giao trong Premium Pack qua Google Drive.


Quay lại Premium Vault · Xem Roadmaps

Cập nhật lần cuối: