CS 361: Algorithms and Data Structures
Homework 5
Due date: 10/28 in class


Assignments will be collected at the beginning of the class period. Please bring a hardcopy to turn in. Your assignment can be hand-written or typed.

For the questions on the homework that ask you to "design an algorithm", your answer should include the following:

  1. Description: A written description of how your algorithm works (at least one paragraph)
  2. Pseudocode: Pseudocode for your algorithm. The pseudocode should give sufficient detail to make an analysis straightforward (e.g. don't hide a for-loop in an English phrase) while still being high-level enough that it can be easily read.
  3. Running Time: Each of the questions specifies a running time. State the recurrence relation for your pseudocode and then use either a recurrence tree or the substitution method to justify the running time of your method.

Homework Questions

  1. Algorithm Design 5.1
  2. Algorithm Design 5.3
  3. For the following recurrence relations, use a recurrence tree to determine an upper-bound on the running time (i.e. your final answer should be a statement in Big-O notation):
    • T(n) = 1T(n/2) + d (This is the recurrence relation for Binary search)
    • T(n) = 16T(n/4) + n^2
    • T(n) = T(n-2) + n^2
    • T(n) = 2T(n-1) + d (This is a simplified recurrence relation for a recursive Fibonacci implementation)


Last modified: Fri Jan 24 10:58:47 PST 2014