An improvement upon a previous presentation of Shellsort. Here, each color indicates the elements which may be swapped during a given iteration of Shellsort.
The number of colors converges to 1 by following a sequence generated by the following code:
while (h < N/3) h = 3*h + 1;
...
//in the main loop
h = h/3
https://d3js.org/d3.v3.min.js