Sorting AlgorithmsIntermediate
Shell Sort
An optimization of insertion sort that allows exchange of elements that are far apart. Uses a gap sequence that decreases to 1, enabling the algorithm to move elements closer to their final positions faster. Named after Donald Shell who invented it in 1959.
#sorting#gap-sequence#insertion-sort-variant#in-place
Complexity Analysis
Time (Average)
O(n^1.25)Expected case performance
Space
O(1)Memory requirements
Time (Best)
O(n log n)Best case performance
Time (Worst)
O(n²)Worst case performance
Input Array
Implementation