View Single Post
Old 11-17-2007, 09:59 AM   #3
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

There are non greedy algorithms for solving this problem in linear time. In particular you should check out the Knuth Plass linebreaking algorithm.

Knuth and Plass, "Breaking Paragraphs into Lines" 1981
__________________
PipeDream is offline   Reply With Quote