Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Java Word
I have to write a program in java for wordwrap with minimum regard...
for example if we have "aaa bb cc ddddd" and want to wrap it in lines with this method the final form should be like this :
-- Line width: 6
aaa Remaining space: 3 (cost = 3 squared = 9)
bb cc Remaining space: 1 (cost = 1 squared = 1)
ddddd Remaining space: 1 (cost = 1 squared = 1)
attention that we don't know number of lines...I don't understand the algorithm which is in wikipedia ,in this link :[^]
but unfortunately I still have problem with understanding the algorithm...can some one explain it with example for me ?
Posted 26-Jan-12 11:07am
SAKryukov at 26-Jan-12 20:54pm
I wonder why? Just the exercise in programming? If so, you really need to prepare yourself to be able to solve the problems to the very end, develop a strong character; and with someone help you just waste time and loose the chance to develop this skill, which is critically important.
TorstenH. at 27-Jan-12 2:01am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 455
1 Sergey Alexandrovich Kryukov 445
2 Maciej Los 290
3 ProgramFOX 275
4 CHill60 225
0 OriginalGriff 550
1 Sergey Alexandrovich Kryukov 470
2 Maciej Los 310
3 ProgramFOX 275
4 Peter Leow 250

Advertise | Privacy | Mobile
Web04 | 2.8.150331.1 | Last Updated 26 Jan 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100