Recursive example 12.28.06
Now we will depart from the examples of recursion which are simply code, and focus on a visual example of what exponential recursion is. We will again be refering back to our triangle example.
In this example we will assume we have a counter i = 0, and we will continue drawing triangles while i < 3 -- i >= 3 is our base case. So currently i is one, so we call our triangle function to draw a triangle inside of our current one.
We now have a smaller triangle enscribed in the larger triangle. Our i value is 1, so we are not yet at our base case. There are three areas in which we need to draw our triangle, so we make 3 recursive calls.
Our i value is now incremented to 2, so we continue to draw. Each of the previous 3 recursive calls will also need 3 triangles drawn, so we will now have a total of 9 recursive calls.
Our i value is now 3, which is our base case. No further recursive calls are made.
Hopefully now you are clear on exponential recursion, and also why I did not persue a career in art.