A good answer might be:

Two Views of Recursion

You need to be able to use both views. Sometimes when you are working on a problem you need to switch between these two views. You might write the code using the static viewpoint, then test and debug the code using the dynamic viewpoint.

Let us practice this. Here is the math-like definition of Triangle:

  1. Triangle( 1 ) = 1
  2. Triangle( N ) = N + Triangle( N-1 )

And here is another version of the Java method Triangle():

int Triangle( int N )
{
    return N + Triangle( N-1 );
}

Say that you try to run this program..... but it never prints out a result.

QUESTION 17:

From a static viewpoint, what is wrong?

From a dynamic viewpoint, what is wrong?