It may happen that you encounter a strange recurrence like this:

$$ T (n) = begin {cases}

c & n <7 \

2T left ( frac {n} {5} right) + 4T left ( frac {n} {7} right) + cn & n geq 7

end {cases} $$

If you are like me, you will realize that you can not use the main theorem and then you will be able to think: "hmmm … maybe a recurrence tree analysis could work." You would then realize that the tree is starting to get very raw. After some research on the Internet, you will see that the Akra-Bazzi method will work! Then you really start looking at the situation and you realize you do not really want to do all the calculations. If you have been like me up to now, you will be delighted to know that there is a simpler way.

Let $ c $ and $ k to be positive constants.

Then leave $ {a_1, a_2, ldots, a_k } $ to be positive constants such as $ sum_1 ^ k a_i <$ 1.

We must also have a recurrence of the form (as our example above):

$$ begin {align}

T (n) & lqc & 0 <n < max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} } \

T (n) + t (a_1 n) + T (a_2 n) + points T (a_k n) & n geq max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} }

end {align} $$

## Claim

So I claim $ T (n) leq bn $ or $ b $ is a constant (for example, asymptotically linear) and:

$$ b = frac {c} {1 – left ( sum_1 ^ k a_i right)} $$

## Proof by induction

**Based**: $ n < max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} } implies T (n) leq c <b <bn $

**Induction**: Assume true for everything $ n <$we have then

$$ begin {align}

T (n) & leq cn + T ( lfloor a_1 n rfloor) + T ( lfloor a_2 n rfloor) + dots + T ( lfloor a_k n rfloor) \

& l afloor + afloor

& lcc + b a_1 n + b a_2 n + points + b a_k n \

& = cn + bn sum_1 ^ k a_i \[0.5em]

& = frac {cn – cn sum_1 ^ k a_i} {1 – left ( sum_1 ^ k a_i right)} + frac {cn sum_1 ^ k a_i} {1 – left ( sum_1 ^ k a_i right)} \[0.5em]

& = frac {cn} {1 – left ( sum_1 ^ k a_i right)} \

& = bn & square

end {align} $$

Then, we have $ T (n) leq bn implies T (n) = O (n) $.

## Example

$$ T (n) = begin {cases}

c & n <7 \

2T left ( frac {n} {5} right) + 4T left ( frac {n} {7} right) + cn & n geq 7

end {cases} $$

We first check the coefficients inside recursive calls whose sum is less than one:

$$ begin {align}

1 &> sum_1 ^ k a_i \

& = frac {1} {5} + frac {1} {5} + frac {1} {7} + frac {1} {7} + frac {1} {7} + frac { 1} {7} \[0.5em]

& = frac {2} {5} + frac {4} {7} \[0.5em]

& = frac {34} {35}

end {align} $$

We then verify that the base case is lower than the max of the inverse coefficients:

$$ begin {align}

n & < max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} } \

& = max {5, 5, 7, 7, 7, 7 } \

& = 7

end {align} $$

With these conditions fulfilled, we know $ T (n) leq bn $ or $ b $ is a constant equal to:

$$ begin {align}

b & = frac {c} {1 – left ( sum_1 ^ k a_i right)} \[0.5em]

& = frac {c} {1 – frac {34} {35}} \[0.5em]

& = 35c

end {align} $$

So we have:

$$ begin {align}

T (n) & leq 35cn \

Earth; T (n) & geq cn \

so T (n) & = Theta (n)

end {align} $$

Similarly, we can prove a connection for when $ sum_1 ^ k = 1 $. The proof will follow much the same format:

Let $ c $ and $ k to be positive constants such as $ k> $ 1.

Then leave $ {a_1, a_2, ldots, a_k } $ to be positive constants such as $ sum_1 ^ k a_i = $ 1.

We must also have a recurrence of the form (as our example above):

$$ begin {align}

T (n) & lqc & 0 <n < max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} } \

T (n) + t (a_1 n) + T (a_2 n) + points T (a_k n) & n geq max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} }

end {align} $$

## Claim

So I claim $ T (n) leq alpha n log_k n + beta n $ (we choose $ log $ based $ k because $ k will be the branching factor of the recurrence tree) where $ alpha $ and $ beta $ are constants (for example, asymptotically linear) such that:

$$ beta = c $$

and

$$ alpha = frac {c} { sum_1 ^ k a_i log_k a_i ^ {- 1}} $$

## Proof by induction

**Based**: $ n < max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} } implies T (n) leq c = beta < alpha n log_k n + beta n $

**Induction**: Assume true for everything $ n <$we have then

$$ begin {align}

T (n) & leq cn + T ( lfloor a_1 n rfloor) + T ( lfloor a_2 n rfloor) + dots + T ( lfloor a_k n rfloor) \

& leq cn + sum_1 ^ k ( alpha a_i n log_k a_i n + beta a_i n) \

& = cn + alpha n sum_1 ^ k (a_i log_k a_i n) + beta n sum_1 ^ k a_i \

& = cn + alpha n sum_1 ^ k left (a_i log_k frac {n} {a_i ^ {- 1}} right) + beta n \

& = cn + alpha n sum_1 ^ k (a_i ( log_k n – log_k a_i ^ {- 1})) + beta n \

& = cn + alpha n sum_1 ^ k a_i log_k n – alpha n sum_1 ^ k a_i log_k a_i ^ {- 1} + beta n \

& = alpha n sum_1 ^ k a_i log_k n + beta n \

& = alpha n log_k n + beta n & square

end {align} $$

Then, we have $ T (n) leq alpha n log_k n + beta n implies T (n) = O (n log n) $.

## Example

Let's change this previous example that we used just a little bit:

$$ T (n) = begin {cases}

c & n <35 \

2T left ( frac {n} {5} right) + 4T left ( frac {n} {7} right) + T left ( frac {n} {35} right) + cn & n geq 35

end {cases} $$

We first check the coefficients inside recursive calls whose sum is equal to one:

$$ begin {align}

1 & = sum_1 ^ k a_i \

& = frac {1} {5} + frac {1} {5} + frac {1} {7} + frac {1} {7} + frac {1} {7} + frac { 1} {7} + frac {1} {35} \[0.5em]

& = frac {2} {5} + frac {4} {7} + frac {1} {35} \[0.5em]

& = frac {35} {35}

end {align} $$

We then verify that the base case is lower than the max of the inverse coefficients:

$$ begin {align}

n & < max {a_1 ^ {- 1}, a_2 ^ {- 1}, ldots, a_k ^ {- 1} } \

& = max {5, 5, 7, 7, 7, 35 } \

& = 35

end {align} $$

With these conditions fulfilled, we know $ T (n) leq alpha n log n + beta n $ or $ beta = c $ and $ alpha $ is a constant equal to:

$$ begin {align}

b & = frac {c} { sum_1 ^ k a_i log_k a_i ^ {- 1}} \[0.5em]

& = frac {c} { frac {2 log_7 5} {5} + frac {4 log_7 7} {7} + frac { log_7 35} {35}} \[0.5em]

& l about 1.048c

end {align} $$

So we have:

$$ begin {align}

T (n) & leq 1.048cn log_7 n + cn \

so T (n) & = O (n log n)

end {align} $$