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

69 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+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents