In this problem, we would like to break a sequence of words into a series of lin
ID: 3635282 • Letter: I
Question
In this problem, we would like to break a sequence of words into a series of lines to formparagraph. Our objective is to avoid extra spaces on any line. The order of words must be maintained as
they are placed on lines. Assume a sequence of n words of length w1, w2, w3, …, wn and a line width of W.
The constraint in this problem is that, if a line contains word I through word j, then wi+…+wj+(j-i)<= W.
Note that the term j-I corresponds to the number of spaces required to separate the words. We define
an objective as follows:
The cost associated for each line is the number of extra spaces on the line:
F = W- wi+…+wj+(j-i)
Give a greedy algorithm for this problem and analyze its time complexity.
Explanation / Answer
Hi, my friend if u can message me why u need this ? this link will give u everything u want http://unicode.org/reports/tr14/
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.