What is an upper bound of T(n) = 2 T(3n/10) + T(4n/10) + n

if assume that T(n) = 2T(3n/10) + T(4n/10) + n <= cnlogn

T(n) <= 6cn/10 * log(3n/10) + 4cn/10 * log(4n/10) + n
= cn/10 * (6(log3 + logn - log10) + 4(log4 + logn - log10)) + n
= cn/10 * (10logn - 10log10 + 6log3 + 4log4) + n
= cnlogn - cn/10 * (10log10 - 6log3 - 4log4) + n <= cnlogn

because (10log10 - 6log3 - 4log4) > 0, there exists c that satisfy the equation.


I think it is the tight upperbound because I failed when I assumed the T(n)<=cn so I think that upper bound of T(n) = O(nlogn)

am I doing right?

• What are you trying to do? I find your post mostly incomprehensible. a) You don't state your goal. b) That calculation is given without any logical context (what we'd call a proof). c) You failing to prove something is no proof of the opposite. – Raphael Apr 4 '16 at 7:53
• Our reference question may help. – Raphael Apr 4 '16 at 8:00
• Note that you can use LaTeX here to typeset mathematics in a more readable way. See here for a short introduction. – Raphael Apr 10 '16 at 12:33

You can prove this using induction, but it will be messy. I'll show you a better approach below (unless you explicitly want to solve it using induction).

Yes, the answer is $O(n \log n)$, which follows most easily using the Akra-Bazzi method. (This is a generalization of the better-known Master theorem, and is extremely useful for solving these types of recurrences.)

Clearly, the recursion satisfies the form from the statement of the Akra-Bazzi theorem: $g(x)=x$, and the constants $a_i$ and $b_i$ obviously satisfy the requirements.

In your case, $b_1=3/10$ and $a_1=2$; and $b_2=4/10$ and $a_2=1$. Thus $a_1\cdot b_1 + a_2\cdot b_2=1$, thus we take $p=1$. By the Akra-Bazzi theorem, the solution is $T(x) = O(x \cdot (1 + \int_1^x \frac{g(u)}{u^{p+1}} du))$. Because $p=1$ we are integrating the function $x/x^2=1/x$.

Since $\int_1^x \frac{1}{u} du = \log x$, we have that $T(x) = O(x (1 + \log x))$ which is $O(x \log x)$.

Using variable $n$ instead of $x$, we state this in more familiar notation: $T(n) = O(n \log n)$.

In fact, Akra-Bazzi gives us a stronger result that $T(n) = \Theta(n \log n)$, from which it immediately follows that $T(n) = O(n \log n)$. This is because $f(n) = \Theta(g(n))$ if and only if $f(n) = O(g(n))$ AND $f(n) = \Omega(g(n))$.