Eine gute Antwort wäre:

A base case of a recursive definition is a case that has an immediate solution.

factorial( 0 ) = 1 <-- base case
factorial( N ) = N * factorial( N-1 )

Static View of Recursion

In the "static view" of recursion, you translate one form of a definition (a math-like definition) into another form (the Java method definition). You don't think much about what happens when the method runs. Here is the math-like definition of recursion:

factorial( 0 ) = 1
factorial( N ) = N * factorial( N-1 )

And here is part of its translation into a Java method:

int factorial( int N )
{
  if ( __________ )

    return 1;

  else

    return ______ * _____________;
}

Practice thinking statically. Translate the math-like definition into the Java code.

FRAGE 3:

Fill in the blanks.

Inhaltsverzeichnis