Which of the following are true of recursion but not iteration? and why? involve
ID: 3725319 • Letter: W
Question
Which of the following are true of recursion but not iteration? and why?
involves repetition of executed code
has substantial overhead for execution
has unique solutions in which only one method (recursion/iteration) can be used to solve the problem
can run indefinitely (in theory)
Answers:involves repetition of executed code
has substantial overhead for execution
has unique solutions in which only one method (recursion/iteration) can be used to solve the problem
can run indefinitely (in theory)
Explanation / Answer
a. involves repetition of executed code
recursion and iteration both involves repetition of executed code . So the statement is true for both.
b. has substantial overhead for execution
Recursion has substantial overhead for execution as it need to track the stack , but iteration does not have this overhead. So the staement is true for recursion but false for iteration.
c. has unique solutions in which only one method (recursion/iteration) can be used to solve the problem
Both recursion and iteration are used to solve the same kind of problems. So a problem which can be solved by recursion , can also be solved by iteration. So the staement is false for both
d. can run indefinitely (in theory)
Iterative method can run indefinitely, if there is no check on condition and recursive method can run indefinitely if there is no base condition. So it is true for both methods.
So Answer is Statement b.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.