Master theorem calculator
Classify a divide-and-conquer recurrence and find its Θ bound. Your inputs stay on your device.
Set up your task
Starting local processing
Ready. Processing stays in this browser.
2 Your result
Your result updates in this browser. Check your input if the result looks unexpected.
How to use Master theorem calculator
Classify a divide-and-conquer recurrence and find its Θ bound. The pre-filled problem gives you a worked starting point. Compare the response with your own working before trying the self-check below.
- Check the example inputs: Subproblems a, Shrink factor b, Polynomial exponent d, Log exponent k.
- Change the inputs for your problem. Results update as you type, so finish entering the values before copying an answer.
- Use the working to check an intermediate value or assumption. Then change the example as suggested in the self-check and compare the result.
Supported inputs and limits
Use T(n) = aT(n/b) + Θ(n^d log^k(n)), with integer a ≥ 1, b ≥ 2 and nonnegative integer d and k within the displayed limits.
How it works
A divide-and-conquer recurrence models a problem split into a subproblems of roughly one bth the original size. The outside work describes splitting, combining or local processing. The exponent log base b of a measures how many leaves the recursion tree has at the scale of the input.
Compare the exponent of the outside polynomial with the recursive exponent. A polynomial gap decides which part dominates. When the exponents match, contributions from successive tree levels combine and give an extra logarithmic factor. This calculator handles the restricted polynomial-times-log family printed with the inputs.
Example
Run the pre-filled example. Its first result is “Θ(n · log(n))”.
- Subproblems a
- 2
- Shrink factor b
- 2
- Polynomial exponent d
- 1
- Log exponent k
- 0
Θ(n · log(n)) Case 2: the polynomial powers match. Add one to the log exponent. log base 2 of 2 = 1.
Questions about Master theorem calculator
What is the base of the logarithm in the work term?
Any fixed base greater than one gives the same Θ class, because a change of base multiplies the term by a constant factor.
Can I use it for T(n−1)?
Choose a different recurrence method. This model requires division of the subproblem size by a constant greater than one.
Set a to 4, b to 2, d to 1 and k to 0.
The recursive exponent is two and dominates the linear outside work. The bound is Θ(n²), written in logarithmic-exponent form.
Related tools
Last updated