In recurision the body begins with a [...], a conditional statement that defines the behavior of the function for the inputs that are simplest to process
Answer
base case
Tags
#python #sicp
Question
In recurision the body begins with a [...], a conditional statement that defines the behavior of the function for the inputs that are simplest to process
Answer
?
Tags
#python #sicp
Question
In recurision the body begins with a [...], a conditional statement that defines the behavior of the function for the inputs that are simplest to process
Answer
base case
If you want to change selection, open original toplevel document below and click on "Move attachment"
Parent (intermediate) annotation
Open it The body
begins with a base case, a conditional statement that defines the behavior of
the function for the inputs that are simplest to process
Original toplevel document
1.7 Recursive Functions til eventually a single-digit input is reached.
This example also illustrates how functions with simple bodies can evolve
complex computational processes by using recursion.
1.7.1 The Anatomy of Recursive Functions
Video:
Show
Hide <span>A common pattern can be found in the body of many recursive functions. The body
begins with a base case, a conditional statement that defines the behavior of
the function for the inputs that are simplest to process. In the case of
sum_digits , the base case is any single-digit argument, and we simply return
that argument. Some recursive functions will have multiple base cases.
The base cases are then followed by one or more recursive calls. Recursive
calls always have a certain character: they simplify the original problem.
Recursive functions express computation by simplifying problems incrementally.
For example, summing the digits of 7 is simpler than summing the digits of 73,
which in turn is simpler than summing the digits of 738. For each subsequent
call, there is less work lef
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.