Algorithm Design and Analysis: Homework 6 - Oct 5, 2008, CSE 565, Penn State Univ., Assignments of Computer Science

A handout for homework 6 in the algorithm design and analysis course at pennsylvania state university, cse 565, fall 2008. It includes instructions, reminders, and exercises for the students. The exercises cover various topics such as maxup, maxdown temperature problem, segmented least squares problem, and dynamic programming.

Typology: Assignments

Pre 2010

Uploaded on 09/24/2009

koofers-user-szx
koofers-user-szx 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Algorithm Design and Analysis October 5, 2008
Pennsylvania State University CSE 565, Fall 2008
Adam Smith Handout 10
Homework 6 Due Friday, October 10, 2008
Please refer to the general information handout for the full homework policy and options.
Reminders
Your solutions are due before the lecture. Late homework will not be accepted.
Collaboration is permitted, but you must write the solutions by yourself without assistance,
and be ready to explain them orally to a member of the course staff if asked. You must also
identify your collaborators. Getting solutions from outside sources such as the Web or students
not enrolled in the class is strictly forbidden.
To facilitate grading, please write down your solution to each problem on a separate sheet of
paper. Make sure to include all identifying information and your collaborators on each sheet.
Your solutions to different problems will be graded separately, possibly by different people, and
returned to you independently of each other.
For problems that require you to provide an algorithm, you must give a precise description of
the algorithm, together with a proof of correctness and an analysis of its running time.
You may use algorithms from class as subroutines. You may also use any facts that we proved
in class or from the book.
Exercises These should not be handed in, but the material they cover may appear on exams:
1. Recall the maxup, maxdown temperature problem for Homework 5. Give a linear-time algorithm
for the same problem which makes a single pass through the data and uses only a constant
amount of workspace (beyond the space needed to store the input).
2. Chapter 5, Problem 2, 4,5.
3. (Divide-and-conquer: local minimum in a tree) Chapter 5, Problem 6.
4. The algorithm we saw in class for the segmented least squares problem requires the quantity ei,j
(the best squared error of any single-line for points ithrough j). Give a O(n2)-time algorithm
to simultaneously compute all the values ei,j. (Hint: See footnote 1 on page 266. The formula
for ei,j is given in the lecture notes and on page 262 of the book.)
5. (One-dimensional Dynamic Programming) Chapter 6, Problems 1,3,10,12.
1
pf2

Partial preview of the text

Download Algorithm Design and Analysis: Homework 6 - Oct 5, 2008, CSE 565, Penn State Univ. and more Assignments Computer Science in PDF only on Docsity!

Algorithm Design and Analysis October 5, 2008

Pennsylvania State University CSE 565, Fall 2008

Adam Smith Handout 10

Homework 6 – Due Friday, October 10, 2008

Please refer to the general information handout for the full homework policy and options.

Reminders

  • Your solutions are due before the lecture. Late homework will not be accepted.
  • Collaboration is permitted, but you must write the solutions by yourself without assistance, and be ready to explain them orally to a member of the course staff if asked. You must also identify your collaborators. Getting solutions from outside sources such as the Web or students not enrolled in the class is strictly forbidden.
  • To facilitate grading, please write down your solution to each problem on a separate sheet of paper. Make sure to include all identifying information and your collaborators on each sheet. Your solutions to different problems will be graded separately, possibly by different people, and returned to you independently of each other.
  • For problems that require you to provide an algorithm, you must give a precise description of the algorithm, together with a proof of correctness and an analysis of its running time. You may use algorithms from class as subroutines. You may also use any facts that we proved in class or from the book.

Exercises These should not be handed in, but the material they cover may appear on exams:

  1. Recall the maxup, maxdown temperature problem for Homework 5. Give a linear-time algorithm for the same problem which makes a single pass through the data and uses only a constant amount of workspace (beyond the space needed to store the input).
  2. Chapter 5, Problem 2, 4,5.
  3. (Divide-and-conquer: local minimum in a tree) Chapter 5, Problem 6.
  4. The algorithm we saw in class for the segmented least squares problem requires the quantity ei,j (the best squared error of any single-line for points i through j). Give a O(n^2 )-time algorithm to simultaneously compute all the values ei,j. (Hint: See footnote 1 on page 266. The formula for ei,j is given in the lecture notes and on page 262 of the book.)
  5. (One-dimensional Dynamic Programming) Chapter 6, Problems 1,3,10,12.

Problem to be handed in

Page limits: The answer to each problem should fit in 2 pages (or one double-sided sheet) of paper. Longer answers will be penalized.

  1. (Multiplication via Divide and Conquer) Given the coefficients of n polynomials of degree 1 each, f 1 , f 2 , ..., fn, we would like to compute the coefficients of their product, g(x) = πni=1fi(x).

(a) Suppose we multiply the polynomials into the product one at a time, that is:

1 g 0 ← 1 2 for i ← 1 to n 3 do gi ← Multiply(gi− 1 , fi) 4 Output gn

where “Multiply” takes time O(d) to multiply a polynomial of degree d with a polynomial of degree 1. How long will this procedure take? (b) Give an algorithm that computes the coefficients of the product in time O(n log^2 n). (Hint: Use divide and conquer to break the product up into evenly balanced sub-products. It may also help to think about what kind of recurrence has n log^2 n as a solution.)

  1. (Word Segmentation): Chapter 6, Problem 5.