Chapter 12 Flashcards
What is a recursive definition? What’s an important piece of such definition?
A recursive definition uses a word or concept that is defined in the definition itself.
Every recursive definition must also have the base case. It’s the “alternative”, unique and non-recursive definition that serves as starting point for all the other points.
What’s the Peano’s definition of Natural numbers?
- 0 is a natural number
- For every natural number n, S(n) - the successor of n - is a natural number.
1 will be S(0), 2 = S(S(0)), every number n as S^n(0).
What is a recursive method?
It’s a method that invokes itself.
What’s the difference between direct and indirect recursion?
Direct recursion constinsts in a method calling directly.
Indirect recursion means that method calls itself by passing through other methods first.