CIS 2500 Lecture Notes - Lecture 13: Grater, Tower Of Hanoi, Quicksort

27 views5 pages

Document Summary

Or when a series of subroutines eventually invoke the first subroutine again the intent is to break a large problem into smaller and simpler problems these smaller solutions are then sombined to solve the larger problem. Factorial example factorials can be calculated recursievly n! = n x (n -1) x (n - 2) x 1 n! = nx(n-1)! if n>0 this second condition suggests recursion the calculation is done with reference to itself. A base case that is processed without recursion. this requires an ending ocndition that knows when to apply the base case. A method that reduces a particular case to one or more smaller cases. this requires a recursive call in the factorial example the base case is n! = 1 if n = 0 (no further recursion needed) And the method to reduce a case to a smaller one is n!

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