redSkywalker

shell

Jul 5th, 2018
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. private void shellSort(int[] vector)
  2.         {
  3.             int step = vector.Length / 2;
  4.             while (step > 0)
  5.             {
  6.                 int i, j;
  7.                 for (i = step; i < vector.Length; i++)
  8.                 {
  9.                     int value = vector[i];
  10.                     for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)
  11.                         vector[j + step] = vector[j];
  12.                     vector[j + step] = value;
  13.                 }
  14.                 step /= 2;
  15.             }
  16.         }
Add Comment
Please, Sign In to add comment