This is a simple C implementation of various sorting algorithms such as Bubble Sort, Insertion Sort, Selection Sort and Shell Sort.

Bubble Sort

Bubble sort, is a simple comparison-based sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.

Complexity:

Worst complexity: n^2
Best complexity: n

Insertion Sort

Insertion sort is a simple sorting algorithm that builds the final list one item at a time. This is an in-place comparison-based sorting algorithm. It is much less efficient on large lists than more advanced algorithms such as quick sort, heap sort, or merge sort.

Complexity:

Worst complexity: n^2
Best complexity: n^2

Selection Sort

Selection sort is an in-place comparison-based algorithm in which the list is divided into two parts, the sorted part at the left end and the unsorted part at the right end. Initially, the sorted part is empty and the unsorted part is the entire list.

Complexity:

Worst complexity: n^2
Best complexity: n^2

Shell Sort

Shell Sort Algorithm, also known as Shell sort or Shell’s method, is an in-place comparison sorting algorithm. It can be seen as either a generalization of sorting by exchange or sorting by insertion.

Complexity:

Average complexity: n*log(n)^2 or n^(3/2)
Best complexity: n