New answers tagged java
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 ...
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)
"...
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 ...
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 ...
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 ...
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…
(...
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, ...
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 ...
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 ...
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 ...
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.
...
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 ...
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 ...
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 ...
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 ...
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 ...
Community wiki
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:
...
5
votes
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 ...
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 ...
Top 50 recent answers are included
Related Tags
java × 10936algorithm × 1301
performance × 1277
beginner × 1025
object-oriented × 731
android × 658
strings × 644
programming-challenge × 636
array × 502
multithreading × 459
game × 421
swing × 415
interview-questions × 358
design-patterns × 302
tree × 275
sorting × 271
linked-list × 257
spring × 222
recursion × 220
unit-testing × 197
parsing × 179
concurrency × 176
homework × 174
time-limit-exceeded × 172
comparative-review × 169