Hi,
I just stumbled across your sorting algorithm visualization page. It's
definitely one of the cleanest implementations I have found on the
net. However, I noticed your implementation of Shell's sort could
have a dramatic improvement in performance with a slight change in gap
selection. The loop for gap selection you have is for(int incr =
a.length/2; incr > 0; incr /= 2). This has the effect of overlapping
the current pass with the results of the last pass. Shell sort is
demonstrated to increase in efficiency with an increase in the
relative primality of the gap size. A quick way to modify your
algorithm to achieve this would be to set incr = incr/2 - 1... this
would allow you to hit several of the Mersenne Primes in the lower gap
sizes (3, 5, 7, 13, 17 for example), as well as make every gap size
after the first pass odd, which increases the chances of any two gap
sizes being relatively prime. This would definitely speed up the
performance of the Shell sort and give a much more dramatic
demonstration of the power of this algorithm.
Thank you for your time.
Eliot Gagnon