Week 5 - Inducing, reducing and recursing. Flashcards
(4 cards)
What is induction?
induction, or proof by induction, is generally used to prove propositions that are statements about natural number (N).
What is recursion?
Recursion is a computational technique that involves a function calling itself. It can be used in the algorithmic quest to break down a problem into smaller and smaller sub-problems.
What are the authors’ three laws of recursion?
A recursive algorithm must:
a) have a base case - usually a simple version of the problem that can be solved directly.
b) involve a state-change that moves the problem stepwise towards the base case.
c) calls itself.
What do the authors mean by the term stack frame?
A stack frame is a record of the local variables, along with their values, that a recursive function is using each time it calls itself.