This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Problem 1 0) Construction of the Algorithm Lets consider a function s ( i,j ) = " j- 1 X k = i c k + 1 # + c j that by definition of the problem calculates the amount of characters there are in a line consisting of the words [ w i ,w i +1 ,...,w j ] Because we know that a line is bounded by L characters, we can find the maximum number of words there are before word w j by finding a k such that s ( k,n ) L s ( k- 1 ,n ) > L or k- 1 < and enclose this operation within a function called find-segment(). We can then make the observation that if k = find-segment() is the starting position of the last line of the optimal solution, then the sum of the slacks square is just | L- s ( k,n ) | 2 + best of slacks 2 ( k- 1). However, if w k is not part of the last line in the optimal solution, then we iterate through all i such that k i < n and find the minimum value of | L- s ( i,n ) | 2 + best of slacks 2 ( i- 1). Already, we can define an optimum function of the sum of squares of the slack that gives us polynomially scaled sets of subspaces with a simple recurrence.polynomially scaled sets of subspaces with a simple recurrence....
View Full Document
- Spring '08