It reduces the time complexity from O(b)O(b)O(b) to O(logb)O(\log b)O(logb).
It handles negative exponents, which loops cannot.
It is the only method that prevents integer overflow.
It is simpler to implement in C++.
The number of positive integers up to n that are relatively prime to n.
The largest prime factor of n.
The sum of all positive integers less than or equal to n.
The number of prime numbers less than n.
The graph is a Directed Acyclic Graph (DAG).
The graph contains edges with negative weights.
The goal is to find the shortest path between all pairs of nodes.
The graph is very dense (many edges).
False
True
Tabulation uses recursion, while memoization uses iteration.
Tabulation is always more space-efficient than memoization.
Only tabulation can solve problems with optimal substructure.
Memoization might not compute all subproblems, whereas tabulation computes them all.
N ≈ 100
N ≈ 5000
N ≈ 20
N ≈ 1,000,000
Finding the longest common substring between two strings.
Finding all occurrences of multiple patterns within a single text in linear time.
Compressing a string using run-length encoding.
Sorting all cyclic shifts of a string.
Using only one large prime modulus.
Using two different large prime moduli and checking for equality of both hashes.
Using a smaller base for the polynomial.
Preprocessing the string with a KMP prefix function.
Whether the points P, Q, and R are equidistant from the origin.
The distance between points Q and R.
The orientation, or whether the sequence of points P-Q-R represents a 'left' turn, 'right' turn, or are collinear.
The area of the circle that passes through P, Q, and R.
Plane Sweep
Greedy Approach
Divide and Conquer
Dynamic Programming
Mo's Algorithm
Rotating Calipers
Aho-Corasick Automaton
Square Root Decomposition
To automatically generate a wide range of random test cases and compare a sophisticated solution's output against a simple, correct (but slow) brute-force solution.
To verify that the code style and formatting meet competition standards.
To rewrite the solution in a different programming language to ensure the logic is portable.
To measure the exact execution time and memory usage of a solution.
All done? Get your grade