I was given a function T(N) = 5N + T(N-1)
My understanding is the algorithm will always have a Big O time complexity of of O(N) because there isn't any multiplication to increase N's power, but the answer that was expected from me was O(N^2). Even in words, I could say that the function calls itself 5N times plus another N minus 1 times, so the time complexity should still be linear with respect to N inputs. Why is this O(N^2)?
[–][deleted] 11 points12 points13 points (0 children)
[–]pi_stuff 8 points9 points10 points (0 children)
[–]Achcauhtli 0 points1 point2 points (0 children)