I CSI 201 Chapter Notes - Chapter 15: Mathematical Game, Binary Search Algorithm, Fibronectin

72 views4 pages

Document Summary

* we have been calling other methods from a method. It"s also possible for a method to call itself. A method that calls itself is a recursive method. This method in the example displays the string this is a recursive method. , and then calls itself. Each time it calls itself, the cycle is repeated endlessly. Like a loop, a recursive method must have some way to control the number of times it repeats. Recursion can be a powerful tool for solving repetitive problems. Recursion is never absolutely required to solve a problem. Any problem that can be solved recursively can also be solved iteratively, with a loop. In many cases, recursive algorithms are less efficient than iterative algorithms. Recursive solutions repetitively: allocate memory for parameters and local variables, and store the address of where control returns after the method terminates. These actions are called overhead and take place with each method call.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents