Click here to Skip to main content
Rate this: bad
good
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 :
http://en.wikipedia.org/wiki/Word_wrap[^]
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
Comments
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.
--SA
TorstenH. at 27-Jan-12 2:01am
   
Homework?

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

  Print Answers RSS
0 Peter Leow 443
1 OriginalGriff 403
2 Kornfeld Eliyahu Peter 260
3 Sergey Alexandrovich Kryukov 242
4 Maciej Los 230


Advertise | Privacy | Mobile
Web01 | 2.8.150301.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