All examples By author By category About

bmershon

Shellsort II

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