What is a stopping state? What is a recursive step? What are the ways in which the computer provides run-time support for recursive methods? Why do some programmers feel that recursion should be avoided?
What will be an ideal response?
In a recursive method, the stopping state is a well-defined termination point. Each method must have a recursive step, in which the methods calls itself, and which must lead to the stopping state.
Computers provide the following support:
* A call stack (storage area) created at startup.
* An activation record (space for parameters, local variables, and return value).
* When a method is returned, its activation record is removed from the call stack.
Naive programmers feel that because recursion repeatedly calls itself, and therefore takes longer and ties up memory, it should not be used. But it is a powerful programming technique.
You might also like to view...
The source data for a PivotTable can come from any external source in any format
Indicate whether the statement is true or false
A(n) __________ is used as an index to pinpoint a specific element within an array.
a. boolean value b. element c. argument d. subscript