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) .

= 2q - 2(n-q)
= 2q - 2n + 2q = 4q - 2n

.

For q=1: .

For q=n-1: .

T(n) c - 2c(n - 1) + c. Picking a large enough c,

T(n) =