Shellsort sorts an array by repeatedly performing an insertion sort on subsequences of elements spaced apart by a decreasing gap sequence, starting with a large gap that lets far-apart out-of-place elements move quickly toward their correct position, and finishing with a gap of one, an ordinary insertion sort pass, on an array that is by then already nearly sorted and so fast to finish. Donald Shell published the method in 1959, one of the earliest sorting algorithms to improve meaningfully on the O(n squared) running time of simple insertion sort, though its exact running time depends heavily on the chosen gap sequence and remains an open area of study. It requires no extra memory beyond the array itself, an in-place sorting algorithm.
Facts
Time ComplexityO(n^2) for the worst known worst-case gap sequence; O(n log^2 n) for the best known worst-case gap sequence 1 Time Complexity
Time Complexity (category)Quadratic Time -- O(n^2) 1 Connections
Credited To
Source Wikipedia: Shellsort
In Field
Source Wikipedia: Shellsort
Invented By
Source Wikipedia: Shellsort
Sources
1. Wikipedia: Shellsort
Infobox: time
O(n 2 ) (worst known worst case gap sequence) O(n log 2 n) (best known worst case gap sequence)
Lead section
The algorithm was first published by Donald Shell in 1959
In Field: Algorithms and Complexity Theory, Lead sentence
Shellsort, also known as Shell sort or Shell's method, is an in-place comparison sort.
View the SourceReader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.