Recursion is used from mathematical routines to sorting and searching. Some of the most spectacular computerized graphics are made using recursion.
- Read the page on recursion and answer the following questions in your own words.
- What are the three criteria for a problem to have a recursive solution?
- Give two benefits of using recursion.
- Give two problems with using recursion.
- Define the following terms as they refer to recursive routines:
- iterative solution
- base case
- depth of recursion
- preconditions
- Read through and trace the factorial function given. Copy the code for the factorial function and then create a main/paint to ask the user for a positive whole number, call the factorial function and print out the results.
- Read through the fibonacci function to be sure you understand it. Again copy the function and create a main/paint to call the function and print out the results.
- Look for code for the Sierpinski Triangle or other fractal. Cut n paste the code and experiment with the parameters.
- Chapter 11, exercises 11.3 #2-3, 11.4 #1(a), 2, 3, 5-9
- Complete exercise 11.10 #5 and 11 (hand in)
- Complete the quizzes on recursion Chapter 70-72