Advertisement
Guest User

Untitled

a guest
Sep 5th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public static void Sort(IComparable[] list)
  2. {
  3. int h = 1;
  4. int length = list.GetLength(0);
  5. while (h < length / 3)
  6. {
  7. h = h / 3 + 1;
  8. }
  9. while (h >= 1)
  10. {
  11. for (int i = h; i < length; i++)
  12. {
  13. for (int j = i; j >= h && (list[j].CompareTo(list[j - h]) < 0); j -= h)
  14. {
  15. Swap(list, j, j - h);
  16. }
  17. }
  18. h = h / 3;
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement