It is worthy of note that in the
average-case scenario of both algorithms
before straight Insertion sort is called, three
boldened numbers are already in their
correct positions in the case of Improved
Shellsort and only two in the case of
Shellsort when (*) and (**) above are
compared. It is obvious that when the total
number of comparisons made are compared
in the two cases after performing straight
Insertion sort on both (*) and (**),
Improved Shellsort performs better. The
algorithm is presented below:
improved ShellSort ( array, size)