What's the time complexity of finding sum of n natural numbers using recursion... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the time complexity of finding sum of n natural numbers using recursion...

I think that recursive block will execute n no.of times so the time complexity will be same as for loop. Correct me if i am wrong... Thx

30th Mar 2021, 6:27 AM
kreddyt
kreddyt - avatar
1 Answer
0
Carlos yea I got it but im asking abt the time complexity of the recursive block .. Will it be same as for loop that i.e O(n) or O(1)
30th Mar 2021, 6:55 AM
kreddyt
kreddyt - avatar