Study Guide for First Midterm

CS 270/680 Mathematical Foundations of Computer Science
Instructor: Jeremy Johnson 
Exam date: (In class on Tue. Oct. 26)


Students are responsible for material in the lecture notes (lectures 1 - 3) and chapter 2 and 3 of the text book.  The midterm will cover induction, recursion, and analysis of the running time of algorithms including asymptotic growth rates and recurrence relations.  Students should be able to prove the correctness and analyze the runtime of simple recursive and iterative programs and carry out an inductive proof.  They should also be comfortable with big-Oh and little-oh notation, definitions, and manipulation.

There will be four problems (problems may have multiple parts)

  1. An inductive proof showing the correctness of a simple iterative or recursive algorithm.
  2. Writing a sum or recurrence relation for the runtime of a simple algorithm, and using the divide and conquer theorem or known sums to analyze the runtime.
  3. Solving a recurrence relation using the substitution method or induction as appropriate
  4. Determine a bound on the asymptotic growth rate of a simple recursive or iterative algorithms and possibly compare the growth rate of two algorithms.  This may involve some simple manipulation of sums and big-oh notation.

Exam Rules

  1. The exam will be designed to take one hour; however, if necessary I will allow 90 minutes.
  2. Students may use a calculator if they want, however, the exam will be designed so that it can be done without a calculator.
  3. Students may not use the text or lecture notes during the exam; however, they may bring one page of notes to the exam.

Practice Problems and Review Session


There will be a review session, where I will go over additional problems as requested, during office hours (4-6:30) on Monday.

  1. Use induction to prove that T(n) defined by the recurrence relation in the graduate question of assignment 3 is equal to the sum derived in the solution provided.
  2. Write down a sum for the number of times the statement S executed in the following nested loop.  Obtain a tight bound on the asymptotic growth rate  of the nested loop assuming that the time for S is O(1).

  3. for (i=0;i<n;i++)
       for (j=0;j<i;j++)
          for (k=0;k<j;k++)
                S;

  4. Let T(n) = 2*T(n-1)+T(n-2), T(1) = T(0) = 1.  Use induction [review complete induction in the text] to show that T(n) <= 3^n, for n >= 1.  Let r = 1+sqrt(2).  Show that T(n) = O(r^n).  Show that r^n = o(3^n).
  5. Show that the binary powering algorithm, in lecture 2, to compute x^n has time bounded by O(log(n)).  You may assume that n=2^k.  Is the result true when n is not a power of 2?  Can you prove the result for general n?