final

# final - MIT OpenCourseWare http/ocw.mit.edu 6.006...

This preview shows pages 1–4. Sign up to view the full content.

MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Introduction to Algorithms: 6.006 Massachusetts Institute of Technology May 9, 2008 Professors Srini Devadas and Erik Demaine Handout 13 Final Practice Problems 1 Subset Sum You are given a sequence of n numbers (positive or negative): x 1 , x 2 , . . . , x n Your job is to select a subset of these numbers of maximum total sum, subject to the constraint that± you can’t select two elements that are adjacent (that is, if you pick x i then you cannot pick either± x i 1 or x i +1 ).± Explain how you can ﬁnd, in time polynomial in n, the subset of maximum total sum.±
2 Handout 13: Final Practice Problems 2 Collecting Coins You are given an n -by- n grid, where each square ( i, j ) contains c ( i, j ) gold coins. Assume that c ( i, j ) 0 for all squares. You must start in the upper-left corner and end in the lower-right corner,

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

final - MIT OpenCourseWare http/ocw.mit.edu 6.006...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online