{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

assignment3 - CSIS 0250B Design and Analysis of Algorithms...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSIS 0250B Design and Analysis of Algorithms Assignment 3 Due: 11:55 PM, Mar 12, 2009 1. Given positive integers a 1 ,a 2 , ··· ,a n , devise a dynamic programming algorithm to determine whether it is possible to divide the n integers into three disjoint subsets with equal sum (which should be equal to 1 3 n i =1 a i ). Your algorithm should run in time polynomial in n and U = n i =1 a i . 2. Consider the problem of neatly printing a paragraph on a type-writer-quality printer, which supports a character set A and prints a character a A with fixed (horizontal) space f ( a ). We assume that the space character occupies 1 unit of space (i.e. f (“ ”)=1). For example, printing two words “abc” and “bca” with one space character in between requires 2( f ( a )+ f ( b )+ f ( c ))+1 units of space. The input text is a sequence of n words w 1 ,w w ,...,w n , each formed by one or more characters from A . We want to print this text neatly on a number of lines, each holds a maximum
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online