Pattern Foundations

Study algorithm patterns through recognition cues, invariants, worked examples, and Python or JavaScript templates. Each lesson links to related practice problems.

  1. Two Pointers (Converging)

    Use on sorted arrays to find pairs. The foundational technique for iterating arrays with two indices.

  2. Fast and Slow Pointers

    A Two Pointer variation where pointers move at different speeds. Perfect for cycle detection in Linked Lists.

  3. Sliding Window (Variable Size)

    Builds on Two Pointers. Use this for contiguous subarrays where you need to track a "state" (sum, frequency, etc.).

  4. Intervals

    An advanced pattern from Educative Grokking for Intervals.

  5. In-Place Manipulation of a Linked List

    An advanced pattern from Educative Grokking for In-Place Manipulation of a Linked List.

  6. Two Heaps

    Advanced optimization. The elite pattern for tracking the running median in a continuous data stream.

  7. K-way Merge

    An advanced pattern from Educative Grokking for K-way Merge.

  8. Top K Elements (Heap)

    The definitive optimization technique. Use to find K largest/smallest items without doing a full O(N log N) array sort.

  9. Binary Search (Find Boundaries)

    Use this to find the "first" or "last" occurrence in a sorted space with O(log N) time complexity.

  10. Subsets

    An advanced pattern from Educative Grokking for Subsets.

  11. Greedy Techniques

    An advanced pattern from Educative Grokking for Greedy Techniques.

  12. Backtracking

    An advanced pattern from Educative Grokking for Backtracking.

  13. Dynamic Programming

    An advanced pattern from Educative Grokking for Dynamic Programming.

  14. Cyclic Sort

    An advanced pattern from Educative Grokking for Cyclic Sort.

  15. Topological Sort (Kahn's Algorithm)

    Advanced Graph theory. Essential for processing nodes with prerequisite dependencies (like Course Schedule).

  16. Sort and Search

    An advanced pattern from Educative Grokking for Sort and Search.

  17. Matrices

    An advanced pattern from Educative Grokking for Matrices.

  18. Stacks

    An advanced pattern from Educative Grokking for Stacks.

  19. Graphs

    An advanced pattern from Educative Grokking for Graphs.

  20. Tree Depth-First Search

    An advanced pattern from Educative Grokking for Tree Depth-First Search.

  21. BFS (Level Order Traversal)

    The foundation for Graphs and Trees. Use for shortest path in unweighted graphs or level-by-level processing.

  22. Trie

    An advanced pattern from Educative Grokking for Trie.

  23. Hash Maps

    An advanced pattern from Educative Grokking for Hash Maps.

  24. Knowing What to Track

    An advanced pattern from Educative Grokking for Knowing What to Track.

  25. Union Find

    An advanced pattern from Educative Grokking for Union Find.

  26. Custom Data Structures

    An advanced pattern from Educative Grokking for Custom Data Structures.

  27. Bitwise Manipulation

    An advanced pattern from Educative Grokking for Bitwise Manipulation.

  28. Math and Geometry

    An advanced pattern from Educative Grokking for Math and Geometry.

  29. Challenge Yourself

    An advanced pattern from Educative Grokking for Challenge Yourself.