I need to analyze shell-sort. Currently I am working with it having an increment of N/2. I will then go on to try more efficient increments.However, my count for comparisons/exchanges seems too low for an array of 2000 elements. I've tried changing it around some but still everything seems too low. Could someone look over my code and see if my counters are in the right places?public class Sort {    static int exchanges= 0;    static int comparisons= 0;    public static void SegmentedInsertionSort (AnyType[] array, int N, int gap)    {        for (int index = gap ; index < N ; index++)        {            AnyType temp;            int j = index - gap;            while (j >= 0)            {                  comparisons++;                  if (array[j].isBetterThan(array[j+gap]))                  {                       temp = array[j];                       array[j] = array[j + gap];                       array[j + gap] = temp;                       j = j - gap;                       exchanges++;                  }                  else j = -1;            }        }    }    public static void shellSort (AnyType[] array)    {        int N = 2000;        int gap = N/2;        while (gap > 0)        {            SegmentedInsertionSort(array, N, gap);            gap = gap / 2;        }    }}Also, I know there are other ways to code this, but the pseudo-code template I was given by my professor looked like this.
Shell Sort Comparisons/Exchanges Counter
java;algorithm;sorting