I am just learning about recurrence relations, and this is an absolute beginner's question. I understand what's going on in the formula, but I have no clue how to write it's solution?
This probably takes no time at all to answer, but thought some helpful people on the Internet can save me the embarrassment of asking someone in person haha.
f(1) = 1
f(n) = f(n-1) + 2(n-1)
from this equation, I extracted the values:
f(2) = 3
f(3) = 7
f(4) = 13
... etc
meaning the differences between each are increments of 2, starting from 2. How would I write the closed equation for this?
Thanks!
Added bonus (I really only need the first one): In a more computer science approach to this question, what would the time complexity for this question be?
Hint: $$ \sum_{k=1}^nk=\frac{n^2+n}{2} $$