CS230 - Assignment 2

  1. Do exercise #2 in section 2.2.2 on p41.  Prove your answer is correct by induction.
     
  2. Solve the following recurrence relation and show you answer is correct by induction.

    T(1)=1
    T(n) = 3nT(n/2) , for n>1 and n a power of 2.
     
  3. Set up a recurrence relation for the running time of the function find0 as a function of a suitable size measure.  Then solve your recurrence relation and prove it is correct by induction.

    In the function L is a point to a node in a list.  L.element() gives you the value of that node and L.next() gives you a pointer to the next node in the list.

    find0(L)
        if L=nil the return FALSE
        else if L.element() = 0 then return TRUE
               else return find0(L.next())