Homework: Recursion I
For each of the following problems, you need to find a
recursive solution. For problems involving NaturalNumber,
use only the kernel methods. Do not use "tricks" like converting a NaturalNumber
into a String and then solving the problem on the String.
- Implement the static method declared as follows:
- Implement the static method declared as follows:
- In addition to the kernel methods, for this question
(only!) you are allowed to use the NaturalNumber method add.
Implement the static method declared as follows:
- Implement the static method declared as follows:
- Implement the static method declared as follows: