
Date: November 30, 2020
RUTGERS UNIVERSITY
The State University of New Jersey
School of Engineering
Department of Electrical and Computer Engineering
14:332:351 Programming Methodology – II Fall 2004
Recurrences
1. Solve the following recurrence equations:
a. T(n) = 2T(n/2 + 17) + n
b. T(n) = 2T(
) + 1
c. T(n) = 2T(n/2) + n3
d. T(n) = 2T(n/4) +
2. The running time of an algorithm A is described by the recurrence T(n) = 7 T(n/2) + n2. A
competing algorithm A’ has a running time of T’(n) = aT’(n/4) + n2. What is the largest
integer value of a, such that A’ is asymptotically faster than A?
3. An array A[1..n] contains all integers from 0 to n except one. It would be easy to determine
the missing integer in O(n) time by using an auxiliary array B[0..n] to record, which numbers
appear in A. In this problem, however, we cannot access an entire integer in A with a single
operation. The elements of A are stored in binary, and the only operation we can use to access
them is “fetch the jth bit of A[i]”, which takes constant time. Show that if we use this
operation, we can still determine the missing integer in O(n) time.
4. An array A[1..n] contains all integers from 0 to n except one. It would be easy to determine
the missing integer in O(n) time by using an auxiliary array B[0..n] to record, which numbers
appear in A. In this problem, however, we are allowed to use only O(1) additional space.
Devise an algorithm to find the missing number.
Page 1 of 1
Readings:
Read Ch 2 (Growth of Functions), 4 (Recurrences) from Cormen et al before next lecture.