I try to solve this equations:
T(n) = T(n-1) + n^2 for n>1
T(1) = 1 for n=1 initial value
knowing that: Σ between i=0 and i=n-1 of ^2 = (+1)(2+1)/6
I proceed as follow:
T(n-1) = T(n-2) + (n-1)^2
T(n-2) = T(n-3) + (n-2)^2
T(n-3) = T(n-4) + (n-3)^2 ecc...
T(n) = T(n-4) + (n-3)^2 + (n-2)^2 + (n-1)^2 + n^2
T(n) = T(1) + ... + (n-2)^2 + (n-1)^2 + n^2 = = 1 + Σ(n-i)^2 = 1 + Σ(n^2 - 2in +i^2) = with i between 0 and n-1
= 1 + n^2 - 2nΣi + Σi^2 = =~ 1 + n^2 - 2n*(n-(n-1)+n-(n-2)+...+n-2+n-1) + n(n+1)(2n-1)/6
In the last passage I have changed the Σ with the given one...
T(n) =~ 1 + n^2 - 2n(an-b) + (2n^3 + 3n^2 + n)/6 =~ O(n^3)
Basically I ignore all the negligible powers of n but I not sure if this is the legitimate things to do...