On this coursera course, the instructor is showing how to convert from the recurrence relation into the actual summation of the work done. What I don't understand is where is the constant amout of work at each level O(n^d)
represented in the summation. Shouldn't it be a(n/b)+O(n^d)
, instead of aO(n/b)^d
?

- 1,481
- 13
- 18
-
Can you clearify exactly which part you don't understand? – ZhaoGang Dec 28 '18 at 13:39
-
Shouldn't it be a(n/b)+O(n^d), instead of aO(n/b)^d? – Danilo Souza Morães Dec 28 '18 at 13:51
2 Answers
Based on the definition of big-O
, as a
, b
, and d
are constant and greater than 1
, both aO((n/b)^d))
and O(n^d)
are equivalent.

- 18,337
- 10
- 57
- 90
-
But the recurrence reads: `a(n/b)+O(n^d)`. Shouldn't then the total work be represented by `aO(n/b)+O(n^d)`? – Danilo Souza Morães Dec 28 '18 at 13:53
-
@DaniloSouzaMorães if `d > 1` they are euivalentin case of `O`. both of them are `O(n^d)`. – OmG Dec 28 '18 at 13:56
-
I think I'm not explaining my question properly. I'll try again: The recurrence relation is ADDing O(n^d) to a(n/b). HOW is `O(n^d) + a(n/b)` equivalent to `aO((n/b)^d))`? HOW did it go from ADDing to MULTiplying? – Danilo Souza Morães Dec 28 '18 at 14:02
In the master theorem of your picture, at each level, the work is nothing else, but divide the current level O(n)
problem into a-th
next level O(n/b)
problems, and then combine them up.
In level 0
, we have only one node in thre tree, this devide and combine
procedure has a O(n^d)
time complextity(a given knowledge according to your picture, different algorithms have different devide and combine
time comlextity).
In level 1
, we have a-th
node, and each node have a devide and combine
procedure, of which the time complextity is O((n/b)^d)
, so the total devide and combine
work in this level is aO((n/b)^d)
.
The total time complexity of the whole work, is the sum of devide and combine
time complexity of each level. Keep in mind that the whole work is nothing else, but doing the devide and combine
all the time.

- 4,491
- 1
- 27
- 39
-
that formula comes from the master theorem. I thought it was meant to be universal – Danilo Souza Morães Dec 28 '18 at 19:47
-
It does can represent different situations, like `O(n)`,`O(n^2)`,`O(n^3)`,etc. But it cann't represent `O(lgn)` or `O(nlgn)`. I suspect there are some cases for these time complextity. See the wikipedia link: https://en.wikipedia.org/wiki/Master_theorem_(analysis_of_algorithms). The universal one should be `f(n)` – ZhaoGang Dec 29 '18 at 00:33