0% found this document useful (0 votes)
4 views1 page

Understanding Recursion Basics

Recursion is a method that calls itself. Every recursive method has two parts: a base case that ends the recursion, and a non-base case that moves toward the base case. For recursion to work properly and terminate, there must be a base case to stop infinite recursion and return a result. The placement of output statements affects whether the output is from the parameter to the base case or vice versa.

Uploaded by

samirveda
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Understanding Recursion Basics

Recursion is a method that calls itself. Every recursive method has two parts: a base case that ends the recursion, and a non-base case that moves toward the base case. For recursion to work properly and terminate, there must be a base case to stop infinite recursion and return a result. The placement of output statements affects whether the output is from the parameter to the base case or vice versa.

Uploaded by

samirveda
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Recursion Notes Recursion (EXAMPLES ONLINE) - A recursive method is a method that calls itself - Every recursive method has

two distinctive parts. o A base case or termination condition that causes the method to end. o A non-base case whose actions move the algorithm toward the base case and termination. - The recursion must have a base case or we have infinite recursion, which will or return any result. - IF SOP is after the recursive call, it prints from the parameter to the base case, if SOP is before the recursive call, it prints from the base case to the number parameter.

You might also like