master-theorem

Understanding Master Theorem

白昼怎懂夜的黑 提交于 2019-12-03 08:40:50
Generic form: T(n) = aT(n/b) + f(n) So i must compare n^logb(a) with f(n) if n^logba > f(n) is case 1 and T(n)=Θ(n^logb(a)) if n^logba < f(n) is case 2 and T(n)=Θ((n^logb(a))(logb(a))) Is that correct? Or I misunderstood something? And what about case 3? When its apply? I think you have misunderstood it. if n^logba > f(n) is case 1 and T(n)=Θ(n^logb(a)) Here you should not be worried about f(n) as result you are getting is T(n)=Θ(n^logb(a)). f(n) is part of T(n) ..and if you get the result T(n) then that value will be inclusive of f(n). so, There is no need to consider that part. Let me know

Can not figure out complexity of this recurrence

旧城冷巷雨未停 提交于 2019-12-01 23:06:57
问题 I am refreshing on Master Theorem a bit and I am trying to figure out the running time of an algorithm that solves a problem of size n by recursively solving 2 subproblems of size n-1 and combine solutions in constant time. So the formula is: T(N) = 2T(N - 1) + O(1) But I am not sure how can I formulate the condition of master theorem. I mean we don't have T(N/b) so is b of the Master Theorem formula in this case b=N/(N-1) ? If yes since obviously a > b^k since k=0 and is O(N^z) where z=log2

Can not figure out complexity of this recurrence

懵懂的女人 提交于 2019-12-01 22:20:37
I am refreshing on Master Theorem a bit and I am trying to figure out the running time of an algorithm that solves a problem of size n by recursively solving 2 subproblems of size n-1 and combine solutions in constant time. So the formula is: T(N) = 2T(N - 1) + O(1) But I am not sure how can I formulate the condition of master theorem. I mean we don't have T(N/b) so is b of the Master Theorem formula in this case b=N/(N-1) ? If yes since obviously a > b^k since k=0 and is O(N^z) where z=log2 with base of (N/N-1) how can I make sense out of this? Assuming I am right so far? ah, enough with the

T(n) = c1T(n/a) + c2(T/b) + f(n)

不问归期 提交于 2019-11-27 16:32:44
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 ? 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 threshold C . Thus the maximum depth of expansion: We choose the smallest between a, b because the parameter with only powers of min(a, b) decreases at the slowest rate : Thus the general expression for T(n) is: The existence