Created: Tue 29 Sep 2009
Wed 30 Sep 2009
Wed 7 Oct 2009
- Please review the course syllabus and make sure that you understand the course policies for grading, late homework, and academic honesty.
- On the first page of your solution write-up,
you must make explicit which problems are to be graded for
"regular credit", which problems are to be graded for "extra credit",
and which problems you did not attempt.
Please use a table something like the following
where "RC" is "regular credit", "EC" is "extra credit", and "NA"
is "not applicable" (not attempted). Failure to do so will result
in an arbitrary set of problems being graded for regular
credit, no problems being graded for extra credit, and a five percent
- You must also write down with whom you worked on the assignment. If this
changes from problem to problem, then you should write down this
information separately with each problem.
Required: Do four of the five problems below. Problem 4 is an exercise in the book but counts as a problem here.
Points: 20 points per problem.
Unless otherwise indicated, exercises and problems are from Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein. The edition (2nd or 3rd) will be indicated if the numbering differs.
- Problem 8-2
- Problem 8-6
- Suppose that you are given the task of devising an algorithm for
sorting n records and that the basic operation in your algorithm is
an exchange: Exchange(i, j) swaps the data records in
positions i and j. (Insertion Sort is an example of such an
algorithm.) The width of an exchange is defined to be the distance
across which data records are moved, i.e., j - i for Exchange(i, j). Prove that any algorithm for sorting which uses
only constant width exchanges must run in Ω(n2) time in the worst case.
- Exercise 9.3-7
- Let the multi-selection problem be defined as follows. The
input is a set S of n distinct keys drawn from some totally
ordered universe, and a set of k + 1 integers ri such that
1 = r0 < r1 . . . < rk = n +1. The output is a partition of S into k
sets S0, . . ., Sk-1 such that Si is the set of all keys with ranks greater than or equal to ri and strictly less than ri+1.
Give an O(n lg k) time comparison-based algorithm for the multi-selection problem. You may assume for simplicity that k is a
power of 2.
College of Computer Science, Northeastern University
360 Huntington Avenue #340 WVH,
Boston, MA 02115
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: