4 ms·
I don't think word processors are bad at hyphenation recently. They do optimize for fewest lines instead of least raggedness though. And Knuth's algorithm takes
by sp332 11y ago
I don't think word processors are bad at hyphenation recently. They do optimize for fewest lines instead of least raggedness though. And Knuth's algorithm takes O(n^2) time which could get significant with long documents and seems like overkill to recompute for every keystroke. I guess it could be computed once when saving or printing though.
- jimktrains2 11y agoIt's only O(n^2) for each paragraph, isn't it? A "Rejustify" button that would recompute the proper justification is an interesting idea.
- sp332 11y agon is the number of words, according to Wikipedia. https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap#Minimum_raggedness https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap#Minimu...
- jimktrains2 11y agoThat's what I meant, it's O(n^2) for the words per paragraph I thought, not the entire document.
- sp332 11y agoOh right... yeah I guess that's true.