sicp-ex-5.28



<< Previous exercise (5.27) | Index | Next exercise (5.29) >>


meteorgan

  
  
  
                          total-pushes             maximum-depth 
 recursion             37n + 33                  3n + 14 
 iteration              34n - 16                    8n + 3 
  
  
  
  
 -------------------------------------------------------------------------- 
 Either this one is backwards or the one above. 
  
                   Maximum depth    Number of pushes 
  +----------+-----------------+------------------+ 
   Recursive |           8n+3  | 34n-16 
   Factorial |                 | 
  +----------+-----------------+------------------+ 
   Iterative |           3n+14 | 37n+33 
   Factorial |                 |