Computer scienceFundamentalsEssentialsProgramming conceptsIntro to programming

Recursion basics

Let's count

Report a typo

Take a look at the draft of the function that counts dolls.

count(X):

  • If X=1,count(X)=1X = 1, count(X) = 1
  • If X>1,count(X)=count(X1)+1X > 1, count(X) = count(X – 1) + 1.

Why is it a bad idea to count dolls recursively here?

Select one option from the list
___

Create a free account to access the full topic