Visual Pattern Walkthroughs
Select any pattern below to inspect line-by-line internal memory states, pointer movements, tree traversals, and DP grids with custom input values.
Two Pointers
Time: O(n) | Space: O(1)Converging or parallel pointers navigating sorted arrays or palindromes in O(n) time.
Sliding Window
Time: O(n) | Space: O(k) or O(1)Dynamically expanding and contracting contiguous subarrays/substrings.
Linked Lists
Time: O(n) | Space: O(1)In-place pointer manipulation, reversals, and fast/slow pointer cycles.
Stacks & Queues
Time: O(n) | Space: O(n)LIFO and FIFO data buffers with Monotonic Stack patterns for next-greater elements.
Trees & BSTs
Time: O(n) | Space: O(h) where h is tree heightHierarchical node traversal: DFS (Pre/In/Post-order) and BFS Level-Order.
Binary Search
Time: O(log n) | Space: O(1)Logarithmic search space reduction on sorted ranges or monotonic predicates.
Graph Traversals
Time: O(V + E) or O(R * C) | Space: O(V) visited set / queueNetwork explorations, 2D Grid Islands, Breadth-First and Depth-First Search.
Dynamic Programming
Time: O(n) or O(n * m) | Space: O(n) or O(n * m)Breaking problems into overlapping subproblems with memoization and tabulation grids.
Backtracking
Time: O(2^n) or O(n!) | Space: O(n) recursion depthExhaustive combinatorial exploration: Choice, Constraint, Goal, and Undo.