Docsity

4 Problems on Algorithm in Mathematics - Assignment 3 | CS 332, Assignments of Computer Science

Toggle sidebar
bg1
CS 332: Algorithms
Homework #3
Assigned: Friday, February 08
Due: Wednesday, February 13 (Note: the day of our first exam)
1. Exercise 9.3-1 (10.3-1 in old book). You must prove your answer for the 7-
element case, but you can argue it informally in the 3-element case (since a
rigorous proof is a bit difficult).
2. Problem 9-1 (10-1 in old book).
3. Exercise 8.1-3 (9.1-3) Hint: Consider the height of the decision tree, and use the
same argument as the proof of theorem 8.1.
4. (9.1-4 in old book, not in the new book): Professor Solomon claims that the
Ω(n lg n) lower bound for sorting n numbers does not apply to his machine, in
which the control flow of a program can split three ways after a single comparison
ai : aj, according to whether ai < aj , ai = aj, or ai > aj. Show that the professor is
wrong by proving that the number of three-way comparisons required to sort n
elements is still Ω(n lg n).

Partial preview of the text

Download 4 Problems on Algorithm in Mathematics - Assignment 3 | CS 332 and more Assignments Computer Science in PDF only on Docsity!

CS 332: Algorithms Homework #

Assigned: Friday, February 08

Due: Wednesday, February 13 (Note: the day of our first exam)

  1. Exercise 9.3-1 (10.3-1 in old book). You must prove your answer for the 7- element case, but you can argue it informally in the 3-element case (since a rigorous proof is a bit difficult).
  2. Problem 9-1 (10-1 in old book).
  3. Exercise 8.1-3 (9.1-3) Hint: Consider the height of the decision tree, and use the same argument as the proof of theorem 8.1.
  4. (9.1-4 in old book, not in the new book): Professor Solomon claims that the Ω( n lg n ) lower bound for sorting n numbers does not apply to his machine, in which the control flow of a program can split three ways after a single comparison a (^) i : aj , according to whether ai < aj , a (^) i = aj , or ai > aj. Show that the professor is wrong by proving that the number of three-way comparisons required to sort n elements is still Ω( n lg n ).