Program for Shell Sort in C and C++

Here you will get program for shell sort in C and C++.

Shell short is an improved and efficient version of insertion sort.

In this algorithm we sort the pair of elements that are far apart by gap h. The process is repeated by reducing h until it becomes 1.

Program for Shell Sort in C and C++

Program for Shell Sort in C

 

Program for Shell Sort in C++

 

Output

Enter number of elements:5
Enter array elements:
56 7 2 9 12

Array after shell sort:
2 7 9 12 56

 

You can watch below video to learn more about shell sort.

Leave a Reply

Your email address will not be published. Required fields are marked *