Click here to Skip to main content
13,093,720 members (62,027 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 10:07am
SAKryukov 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. 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 26 Jan 2012
Copyright © CodeProject, 1999-2017
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