A method or a function is recursive if it calls itself.
Recursion can be used to replace repetition. We will see how the while loop in the shark chase can be replaced by using recursion.
In the lab you can try to solve the butterfly chase recursively as described in exercise 2, P.250-251.
Homework
- Read pages 231-232,
- Review questions section 8.1.
- Play the Towers of Hanoi puzzle.
No comments:
Post a Comment