Recursive Daisy
CC licensed photo by Alexandre Duret-Lutz on Flickr

Recursion and stuff…

Welcome to my brand new post. This time I want to show how to use recursion in a very simple function. We already did this in an iterative way and I thought it would be nice to show how to do it in the recursive way. I’m talking about the fibonacci numbers.

Here is a short video explaining an example of the recursive funcition to calculate the fibonacci number of a given index.

Check also this resources to know when to use recursive functions.

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

In this article the dicussion is set around when to use a recursive function. The answer can’t be easier: when a function calls itself.

Personally, I like cplusplus.com I’ve found useful articles and discussions about many topics. Believe me there’s a post for your questions there.

Here’s another piece of information from cplusplus.com:

http://www.cplusplus.com/forum/articles/2231/

 

 

CC BY 4.0 Mastery 21 by Octavio Rojas is licensed under a Creative Commons Attribution 4.0 International License.