**
**

**Implementation**
Actually, the data sequence is not arranged in a
two-dimensional array,
but held in a one-dimensional array
that is indexed appropriately.

The algorithm uses an increment sequence to determine
how far
apart elements to be sorted are:
h_{1}, h_{2}, ..., h_{t} with
h_{1} = 1

At first elements at distance **h**_{t} are sorted,
then elements at distance **h**_{t-1} are sorted, etc,
until finally the array is sorted using insertion sort
(distance h_{1} = 1).

An array is said to be **h**_{k}-sorted if all
elements spaced a distance **h**_{k} apart
are sorted relative to each other.

Shellsort only works because an array that is
**h**_{k}-sorted
remains **h**_{k}-sorted
when **h**_{k- 1}-sorted.
This means that subsequent sorts
with a smaller
increment do not undo the work done by previous phases.