Skip to main content

New answers tagged

2 votes

A Java program for compressing/decompressing files via Huffman algorithms (version 1.1.1)

random findings: final classes - what is the advantage? repeated code (contributes to an overall impression of verbose) "...
greybeard's user avatar
  • 7,819
5 votes

A Java program for compressing/decompressing files via Huffman algorithms (version 1.0.0)

Multiple aspects of this implementation of a Huffman encoder and decoder are inefficient. At the top level, a bit-by-bit tree-walking decoder is inherently slow. Almost every practical decoder uses ...
user555045's user avatar
  • 12.6k
3 votes

Huffman code builder in Java - computing prefix codes for arbitrary (generic) alphabets - Take II

The HuffmanEncoder is not an encoder. It's a builder that constructs the code table for the symbols based on the weights. An encoder would take input and encode it ...
TorbenPutkonen's user avatar
3 votes

HuffmannEncoder.java - computing prefix codes for arbitrary (generic) alphabets

Minor but, Huffman only has a single n in the name. But let's move on to how the code words are built, the meat of the algorithm after all. ...
user555045's user avatar
  • 12.6k
3 votes

HuffmannEncoder.java - computing prefix codes for arbitrary (generic) alphabets

Style When I look at your formatting in the following snippet, for some reason you have a newline after the first argument to Double.compare, but this line would be ...
Chris's user avatar
  • 6,126
1 vote

Computing the smallest number of the form floor(8^N / 7) that is greater or equal to a number

Firstly, there's absolutely no comments for the reader to understand the purpose of this calculation, i.e. what it might be used for. The name getsize() isn't much ...
Toby Speight's user avatar
  • 88.7k
-2 votes

Computing the smallest number of the form floor(8^N / 7) that is greater or equal to a number

You want ...
Eric Towers's user avatar
4 votes

Computing the smallest number of the form floor(8^N / 7) that is greater or equal to a number

As chux said: Perhaps more research will lead to a no test approach. I've found this solution, which is indeed C++ instead of C but let's look past that for now: ...
user555045's user avatar
  • 12.6k
2 votes

Computing the smallest number of the form floor(8^N / 7) that is greater or equal to a number

For fun, consider a tree of depth log2(X_MAX). Is there a more direct way (loop-free) to compute this number than computing a level and then going back? A simple binary decision tree with 4 compares....
9 votes
Accepted

Computing the smallest number of the form floor(8^N / 7) that is greater or equal to a number

is there a more direct way? Look up table With 32-bit int, level is so limited in range as ...
chux's user avatar
  • 36.5k
2 votes

Computing the smallest number of the form floor(8^N / 7) that is greater or equal to a number

0x49249249 consider giving it a name - approximation of the multiplicative inverse of 7 mod the power of 2 that is the least multiple of 3 no less than the number ...
4 votes

Three non-negative integer encoding techniques in Java

As another review says, I'm not convinced [it] is correct. Suitable conviction could be assured by providing actual unit tests. These would differ from the sample usage shown in a number of ways: ...
Toby Speight's user avatar
  • 88.7k
5 votes

Three non-negative integer encoding techniques in Java

...
user555045's user avatar
  • 12.6k

Top 50 recent answers are included