Shellsort - Pseudocode

Pseudocode

Using Marcin Ciura's gap sequence, with an inner insertion sort.

# Sort an array a. gaps = foreach (gap in gaps) # Do an insertion sort for each gap size. for (i = gap; i < n; i += 1) temp = a for (j = i; j >= gap and a > temp; j -= gap) a = a a = temp

Read more about this topic:  Shellsort