Recurrence relation for time complexity $T(n) = T(n-1) + n^2$
Just continue your reasoning as follows.

\begin{eqnarray}
T(n) &amp;=&amp; T(n-1) + cn^2 \\
&amp;=&amp; T(n-2) + c(n-1)^2 + cn^2 \\
&amp;=&amp; \ldots \\
&amp;=&amp; T(n-n) + c(1^2) + c(2^2) + \ldots cn^2 \\
&amp;=&amp; T(0) +c\sum_{1\leq i\leq n} i^2.
\end{eqnarray}   

Do you know how to simplify this using the addition formula for the first $n$ squares?