Assume we do not know what the worst partition is.
T(n) = (T(q) + T(n-q)) + .
By the substitution method (since we know the answer), try T(n) cn2.
= 2q - 2(n-q) = 2q - 2n + 2q = 4q - 2n
.
For q=1: .
For q=n-1: .
T(n) cn2 - 2c(n - 1) + cn2. Picking a large enough c,