Skip to main content\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 5.14 Self-check
Checkpoint 5.14.1.
What are the three laws of recursion for an algorithm? (choose all that are correct)
-
It must progress from the base case
-
If it starts at the base case, then when would it stop?
-
It must move towards the base case
-
Correct. The base case is your endpoint.
-
It must have a base case
-
Correct. The base case is essential if you want a stopping point
-
It must call itself
-
Correct. If it doesn’t call itself then it won’t repeat
Checkpoint 5.14.2.
Checkpoint 5.14.3.
Sometimes recursion can be more computationally expensive than an alternative, True or False?
-
True
-
Correct! Sometimes simple problems only need simple solutions, like a loop
-
False
-
Incorrect. Recursion is not always the ideal solution.
You have attempted
of
activities on this page.