Name (print) ___________________________________   Lab Section you attend______________

CSE131 Quiz 2
Recursion
12 Sept 2008

  1. Consider the following recursive function:
        g(n)  =   g(n-1) + g(n-2)   n > 1
              =   1                 n = 1
              =   0                 n = 0
    
    Below, use the substitution model to show the evaluation of g(4).
    
    
    
    
    
    
    
    
  2. Consider the following recursive function:
       f(n) =   n - f(n-1)        n > 0
            =   0                 n = 0
    
    Below, write the recursive Java method that computes the above function, given an integer n greater than or equal to zero.
    
    
    
    
    
    
    
    
    
    
    
    
  3. For the above function f show the data flow model for the computation f(3).
    
    
    
    
    
    
    
    
    
    
    
  4. (Based on the guest lecture) Describe one property of a distributed system and given an example of that property. Use the back of this page if necessary.