Skip to main content

New answers tagged

2 votes

A simple method for compressing white space in text (Java) - Take II

Just some remarks. By providing a capacity: new StringBuilder(textLength) - here a bit extra room, you prevent internal array resizing inside StringBuilder. For ...
Joop Eggen's user avatar
  • 4,676
4 votes

A simple method for compressing white space in text (Java) - Take II

Readable. (A big plus in my book.) Verbose. I find what benefits I see unconvincing. (Given the ease of copies, the typo // Scan empty suffix is any: is strange.) I'...
greybeard's user avatar
  • 7,749
5 votes
Accepted

A simple method for compressing white space in text (Java) - Take II

For exhaustiveness, I'd probably suggest your test if loIndex equals hiIndex should test to see if the former is greater than or ...
Chris's user avatar
  • 4,724
7 votes
Accepted

A simple method for compressing white space in text (Java)

Simplicity It strikes me that the simplest method to do this is to leverage the standard library. You will want to learn how to use regular expressions. Your effort will be rewarded. ...
Chris's user avatar
  • 4,724
2 votes

ShannonFanoEncoder.java - computing prefix codes in Java

Your algorithm is definitely more readable and has better naming than the java version in the web. However there still seems to be room for improvement. To offer a comparison, I did the Shannon-Fano ...
Joop Eggen's user avatar
  • 4,676
1 vote

Comparing run-length decoding algorithms

From a purely style standpoint, I can't help but think that your code would be improved by using a conditional guard. ...
Chris's user avatar
  • 4,724

Top 50 recent answers are included