Going low to high would do this:
1. Sort with step size 1 (aka. basic insertion sort, O(n^2) worst performance)
2. Sort with step size 3 (already sorted, O(n))
3. Sorted with step size 5...
Type: Posts; User: helloworld922
Going low to high would do this:
1. Sort with step size 1 (aka. basic insertion sort, O(n^2) worst performance)
2. Sort with step size 3 (already sorted, O(n))
3. Sorted with step size 5...
Try computing the values in the increment, then start running from the value that's gap size is less then the length of the array and work your way down to 1.