title: Is Sedgewick's Shell Sort the most optimal one?
body: <p>The following is Sedgewigck's version of the Shell Sort. Is it the most optimal or are there more efficient ones?</p>
  <pre><code>import java.util.Arrays;
  public class ShellSortSedgewick {
  
  public static void main(String[] args) {
      { // Sort a[] into increasing order.
          int [] a={5,8,44,77,23,81,90,52,25,21,35};
          int N = a.length;
          int h = 1;
          while (h &lt; N / 3) {
              h = 3 * h + 1; // 1, 4, 13, 40, 121, 364, 1093, ...
          }
          while (h &gt;= 1) { // h-sort the array.
              for (int i = h; i &lt; N; i++) { // Insert a[i] among a[i-h], a[i-2*h], a[i-3*h]... .
                  for (int j = i; j &gt;= h &amp;&amp; a[j] &lt; a[j - h]; j -= h) {
                   int temp=a[j];
                   a[j]=a[j-h];
                   a[j-h]=temp;
                  }
              }
              h = h / 3;
              System.out.println(Arrays.toString(a));
          }
      }
            // See page 245 for less(), exch(), isSorted(), and main().
  }
  </code></pre>