Example T(n)=T(n/3)+T(n/4)+3n is this solvable with iterative master theorem or recursion tree.Can someone solve it analytically to show how it's done ?
相关问题
- PHP Recursively File Folder Scan Sorted by Modific
- Time complexity for recursion in for loop
- recursion, Python, countup, countdown
- Is there a sorting algorithm with linear time comp
- Time complexity of Array.from
相关文章
- Recursively replace keys in an array
- Python: Maximum recursion depth exceeded when prin
- Is recursion good in SQL Server?
- How does this list comprehension over the inits of
- Find all subfolders of the Inbox folder using EWS
- What is the definition of “natural recursion”?
- Is there any well-known paradigm for iterating enu
- Is there any function that is in o(1)?
We can expand
T(n)
with a binomial summation:(after some steps - can be proven by induction
For some depth of expansion / recursion
k
.Where do we terminate? When the parameters to all instances of
f(n)
reach a certain thresholdC
. Thus the maximum depth of expansion:We choose the smallest between
a, b
because the parameter with only powers ofmin(a, b)
decreases at the slowest rate:Thus the general expression for
T(n)
is:The existence of a closed form analytical solution depends on the form of
f(n)
. For the example provided:The inner summation is the expansion of a binomial bracket raised to power
j
:This is a geometric series, and equals (using standard formula):
Now since
7/12
is less than 1, the power term in the above result becomes vanishingly small for large values ofk
(and thusn
). Therefore in the limit of largen
:Truth be told the above example could have been done more straightforwardly with a recursion tree; but the same does not go for e.g. other powers of
n
, e.g.f(n) = Cn^2
, which can be trivially incorporated into the general formula.