Midterm Exam 1 Review: Recursion, Iteration, and Order of Growth
Midterm Exam 1 Review: Recursion, Iteration, and Order of Growth
Raising to a Power (Exponentiation)
Recursive Approach
Trace of Recursive power
An Inductive Proof of the Correctness of
power
Linear Recursion
Iterative Approach
Accumulating Partial Products
Iterative Procedure for power
Trace of Iterative power
Linear Iteration
Recursion vs. Iteration
Linear Recursion vs. Linear Iteration
Using Tree Recursion
Tree Recursive Procedure for power
Trace of Tree Recursive power
Tree Recursion Efficiency
Tree Recursion Efficiency (cont'd)
Comparison Table
Tree Iteration?
Logarithmic Recursion
From Tree to Single Branch
Trace of Logarithmic Recursive power
Comparison Table
Logarithmic Iteration
Trace of Logarithmic Iterative power-product
Comparison Table
Exercise 4.6, p. 98