C Shell Sort

Summary: in this tutorial, you will learn about the Shell sort algorithm and how to implement it in C.

Overview of Shell sort algorithm

The Shell sort algorithm is an extension of the insertion sort algorithm. Instead of exchanging adjacent elements, the Shell sort arranges elements that are far apart.

Shell sort is a multipass algorithm where each pass is an insertion sort of  the sub-lists that consist of every  hth element for a fixed h increment or gap.

The complexity of the Shell sort algorithm depends on the gap sequence.

The Shell sort is also referred as Shellsort or Shell’s method (because it is also the name of its author: Donald Shell).

C Shell sort implementation

The following is the C Shell sort implementation.

 

In this tutorial, you have learned about the C Shell sort and how to implement it in C.