Can someone please help me with this ?
Use iteration method to solve it. T(n) = T(n-1) +n
Explanation of steps
Another solution:
T(n) = T(n-1) + n
= T(n-2) + n-1 + n
= T(n-3) + n-2 + n-1 + n
// we can now generalize to k
= T(n-k) + n-k+1 + n-k+2 + ... + n-1 + n
// since n-k = 1 so T(1) = 1
= 1 + 2 + ... + n //Here
= n(n-1)/2
= n^2/2 - n/2
// we take the dominating term which is n^2*1/2 therefor 1/2 = big O
= big O(n^2)