Skip to main content

New answers tagged

3 votes

A tiny Java framework for gathering running time statistics - Take III

These are just a few quick addenda to any other comments you receive: Why are you displaying times in nanoseconds? Is that likely to be useful to humans? Why are you sometimes displaying times in ns ...
David Conrad's user avatar
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
6 votes
Accepted

A tiny Java framework for gathering running time statistics - Take III

Nitpicking on style. Meaningful but pointless names It seems interesting to me that you give a nice meaningful variable name like iteration to a variable that you ...
Chris's user avatar
  • 6,126
6 votes

A tiny Java framework for gathering running time statistics - Take II

DRY If you're sorting your durations to calculate the median, why bother calculating the minimum and maximum on a rolling basis as you collect them, rather than just accessing the first and last value ...
Chris's user avatar
  • 6,126
4 votes

A tiny Java framework for gathering running time statistics - Take II

I was only able to find three points this time: Mean precision: You still accumulate meanDuration as a long. Dividing later ...
Chip01's user avatar
  • 687
2 votes

A tiny Java framework for gathering running time statistics

You haven't tagged reinventing-the-wheel. You do not use java.util.LongSummaryStatistics - no standardDeviation there… (...
greybeard's user avatar
  • 7,819
3 votes

A tiny Java framework for gathering running time statistics

I'm more of a mid-java guy than a JAVA guy, and I am not really sure about possible enhancements, but this is what came to my mind: Median calculation requires sorting Right now, ...
Chip01's user avatar
  • 687
3 votes

A tiny Java framework for gathering running time statistics

Computing median It looks like your computation of median is incorrect. At no point in the following method do you appear to have sorted the data in your list before getting the middle point or mean ...
Chris's user avatar
  • 6,126
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
4 votes

Jump point search in Java for faster pathfinding in grid mazes

To handle diagonal moves that cross walls, you need to relax the corner-blocking logic in both the jumper and the neighbour finder. Right now, your ...
gdoura mohamed's user avatar
3 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,716
3 votes

Object oriented programming deque implementation (another second thought)

(Please see effectiviology on what to avoid in investing in implementation efficiency.) I see a lot of undocumented code that I feel I have seen somewhere else in the file - take the ...
greybeard's user avatar
  • 7,819
2 votes

Object oriented programming deque implementation (another second thought)

I can see reasons to come up with alternatives to java.util.ArrayList<E>: some of its implementations of ...
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
1 vote

Computing loan cuts leading to a global zero equity in a financial graph (Java)

Comparing to false In more than one place you have code like the following. You should never need to explicitly compare a boolean value to ...
Chris's user avatar
  • 6,126
2 votes

Benchmarking in Java some super linearithmic sorting algorithms

(I acknowledge title&introduction read benchmarking and comparison. (I suggest to think compare implementations of several algorithms rather than compare several algorithms.) For now going neither ...
greybeard's user avatar
  • 7,819

Top 50 recent answers are included