#Mastery21

Recursion is when a function calls itself a determinated number of times. This programming technique will help you when when you want to REPEAT the same part of code, that sounds like looping and is easy to understand.

Calculating the factorial of a number is a very good example of recursion. Here you can see a picture:

In the picture is really clear how the function is called again, but the function calls itself until the function gives a result.

I did a pp to explain this with more detail and there you can find more examples of recursion, this is the link:

https://drive.google.com/file/d/0B-NM4ghaDXBvMFZ0TEVTeVFaQ0E/view?usp=sharing

You can find my c++ in this links:

 https://drive.google.com/file/d/0B-NM4ghaDXBvQTlDUk9sTTF3czg/view?usp=sharing

 https://drive.google.com/file/d/0B-NM4ghaDXBvR0taeXlfUEJRcXM/view?usp=sharing

  https://drive.google.com/file/d/0B-NM4ghaDXBvQ3JNdEhFaWFOUWM/view?usp=sharing

Finally, I found useful information here:

http://www.cplusplus.com/articles/D2N36Up4/

 

CC BY 4.0 #Mastery21 by Tania Pardo is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.