C. Enhanced Shell Sort Algorithm
Enhanced Shell Sort algorithm works in the same way as
existing Shell Sort algorithm. Calculating the value of ‘h’ is a
key step in the execution of shell sort. The value of ‘h’ in
conventional shell sort is determined by the formula:
Let h1 = 1, hs+1 = 3hs + 1, and stop with ht when ht+2 ≥ N.
By using this existing formula the shell sort algorithm
reduces the number of swaps up to 50 % as compared to that
of Insertion Sort.
Enhanced Shell Sort algorithm focuses to improve the
efficiency of the existing algorithm .Efficiency in the existing
algorithm can be improved by choosing the appropriate values
of ‘h’. Selection of the proper value of ‘h’ is a key point to
make it more efficient. Because before comparing all elements
of array with each other, it sounds good to arrange elements to
some extent so that when the spacing factor is ‘1’ the number
of swaps could be reduced maximally [7,8].
Enhance Shell Sort introduces a new mechanism for
calculating the value of h. The formula is given below to
calculate the first spacing for ‘h’.
H= Ceil (n/2).,n is the total number of elements in the array.
To calculate the next values of h the following formula is