Basically, you have a list of numbers to sort, and a set of separation distances:
a1, a₂,… an, where ai >
a(i+1). First you compare pairs of numbers ai apart and swap as
necessary. Then, you compare pairs a₂ apart, swapping as necessary, etc. until
you compare and swap immediately adjacent values. The efficiency of the sort will of
course depend on a good choice for the values a1 through an.
ShellSort source code