Algorithm 4.4.6 Robot Walking This algorithm computes the function

!
Algorithm 4.4.6 Robot Walking
This algorithm computes the function defined by
#1
n =1
%
walk(n) = $2
n =2
% walk(n "1) + walk(n " 2) n > 2
&
Input: n
Output: walk(n)
1 Walk(n){
2
If (n == 1 or n == 2)
3
Return n
4
Return walk(n-1)+walk(n-2)
5 }
Questions:
1. Trace algorithm 4.4.6 for n = 4.
2. Write another robot walking algorithm if the robot can take steps of length 1,2 and 3.
3. Consider this recursive algorithm:
Algorithm computing F(n) = F(n-1) + 7
Input: n
Output: F(n)
F(n){
if (n=0)
return 12;
else
return F(n-1) + 7
}
(from website by Dillon Sadofsky and Leo Glass)
a. trace the algorithm for n = 1, 2, 3, 4, and 5.
b. Use induction to show that F(n) = 30n + 7
4. Algorithm for the recursive logistic equation:
f(n)=r f(n-1) [1-f(n-1)], with r some constant
Input: n
Output: f(n)
f(n){
if (n=0)
return .1;
else
return r f(n-1) [1-f(n-1)]
}
a. trace the algorithm for n = 1, 2, 3 and assuming r = 2
b. Not a question, but a demonstration 
This is the algorithm as executed by maple if we assume r = 1.5
f[0] = .1
For[ n = 1, n < 11, n++, { f[n] = 1.5f[n - 1](1 - f[n - 1]), Print[f[n]] }]
Output:
0.1
0.135
0.175163
0.216721
0.254629
0.28469
0.305462
0.318233
0.325441
0.329294
Plot:
Note that the plot gives us the graph of a logistics equation (as found in for instance
population studies).