next up previous
Up: Previous:

Analysis

T(n) $\leq$ \(T(\lceil \frac{n}{5} \rceil)\) + T(7n/10 + 6) + O(n)
To get T(7n/10 + 6), note that the smallest partition size would be
\(3(\lceil \frac{1}{2} \lceil \frac{n}{5} \rceil
\rceil \;-\; 2) \;>=\; (\frac{3n}{10} \;-\; 6)\)
7n/10 + 6 denotes number of elements in larger partition



Assume T(n) $\leq$ cn for \(\lceil n/5 \rceil\) and 7n/10+6
T(n) = O(n)
T(n) $\leq$ c(n/5) + c(7n/10 + 6) + O(n)
= cn/5 + c7n/10 + c6 + O(n)
= 1/10(2cn + 7cn + 60c + O(n)) $\leq$ cn
2cn + 7cn + 60c + O(n) $\leq$ 10cn
60c + O(n) $\leq$ cn
c(n - 60) $\geq$ O(n)
c $\geq$ O(n) / (n - 60)
c is a valid constant for large enough n.
Stopping condition: T(n) = $\Theta(1)$, if n $\leq$ 80


next up previous
Up: Previous: