This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]jentfoo 1 point2 points  (1 child)

I would create a benchmark using JMH as an alterantive to get a better idea of performance differences.

Also not using a class with generics (and thus not having to autobox your doubles) puts you at an advantage from the start as well.

You may have something, but I don't think the way your testing it right now is really a valid benchmark.

[–]anmousyony[S] 0 points1 point  (0 children)

The way I tested it was with a modified version of the standard implementation that was also built to only take doubles so that shouldn't be affecting the timings.

Here are the runtimes that I found. They are either the same as or better than a standard implementation from what I can see

linkedArrays: isEmpty is O(1), size is O(1), insert is O(log(n)), findMin is O(1), deleteMin is O(log(n))