how can I pass the iterative shellSort algorithm to recursive ..?

0

I am trying to transform the following algorithm from iterative to recursive:

    void shellSort(int a[], int h)
    {
      int i;
      while (h > 0)
      { for (i = h-1; i<n; i++)
        {
           int B = a[i];
           int j = i;
           for (j = i; (j >= h) && (a[j - h] > B); j -= h)
           { a[j] = a[j - h];} 
             a[j] = B;
         }
           h = h / 2;
      }
    }

Any help is welcome. Thank you in advance

    
asked by marcosS 16.06.2018 в 08:01
source

0 answers