Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Sort(IComparable[] list)
- {
- int h = 1;
- int length = list.GetLength(0);
- while (h < length / 3)
- {
- h = h / 3 + 1;
- }
- while (h >= 1)
- {
- for (int i = h; i < length; i++)
- {
- for (int j = i; j >= h && (list[j].CompareTo(list[j - h]) < 0); j -= h)
- {
- Swap(list, j, j - h);
- }
- }
- h = h / 3;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement