22.3. Sets

 
[Page 650]

Chapter Summary

  • A recursive method is a method that invokes itself directly or indirectly. For a recursive method to terminate, there must be one or more base cases.

  • Recursion is an alternative form of program control. It is essentially repetition without a loop control. It can be used to specify simple, clear solutions for inherently recursive problems that would otherwise be difficult to solve.

  • Sometimes the original method needs to be modified to receive additional parameters in order to be invoked recursively. A recursive helper method can be declared for this purpose.

  • Recursion bears substantial overhead. Each time the program calls a method, the system must assign space for all of the method's local variables and parameters. This can consume considerable memory and requires extra time to manage the additional space.

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net