Week 5 - Inducing, reducing and recursing. Flashcards

1
Q

What is induction?

A

induction, or proof by induction, is generally used to prove propositions that are statements about natural number (N).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is recursion?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the authors’ three laws of recursion?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do the authors mean by the term stack frame?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly