Homework assignment 4
CSCI 3650
Summer 2002

Due: Thursday, June 13.

These assignments are from Cormen/Leiserson/Rivest.

  1. Second edition: Page 930, 32.4-1. First edition: Page 875 34.4-1. The text uses the Greek letter pi as the name of the failure function.

  2. Second edition: Page 931, 32-1(a). First edition: Page 883 34-1(a).

  3. You are given an array x of n real numbers, and an integer m. You must find a value i where 0 <= i < n-m such that the sum x[i]+x[i+1]+...+x[i+m] is as large as possible. Describe an algorithm that solves this problem in time O(n). Assume that arithmetic (addition, subtraction, multiplication and division) on real numbers takes constant time per operation.