
shell sort
Sign in to saveAlso known as Shell's method, Shellsort, Shell sort, Shell's method
thumb|alt=The steps of Shellsort.|Swapping pairs of items in successive steps of Shellsort with gaps 5, 3, 1 Shellsort, also known as Shell sort or '''Shell's method''', is an in-place comparison sort. It can be understood as either a generalization of sorting by exchange (bubble sort) or sorting by insertion (insertion sort). The method starts by sorting pairs of elements far apart from each other, then progressively reducing the gap between elements to be compared. By starting with far-apart elements, it can move some out-of-place elements into the position faster than a simple nearest-neigh
Key facts
- Algorithm.class
- Sorting algorithm
- Algorithm.image
- Step-by-step visualisation of Shellsort
- Algorithm.caption
- Shellsort with gaps 23, 10, 4, 1 in action
- Algorithm.data
- Array
- Algorithm.time
- O(n2) (worst known worst case gap sequence)O(n log2n) (best known worst case gap sequence)
- Algorithm.best time
- O(n log n) (most gap sequences)O(n log2n) (best known worst-case gap sequence)
- Algorithm.average time
- depends on gap sequence
- Algorithm.space
- О(n) total, O(1) auxiliary
- Algorithm.optimal
- No
via Wikipedia infobox
Wikidata facts
- Image
- Sorting shellsort anim.gif
Show 2 more facts
- time of discovery or invention
- 1959-00-00
- Stack Exchange tag
- stackoverflow.com/tags/shellsort
Sources (3)
via Wikidata · CC0
Article · Português
Criado por Donald Shell em 1959, publicado pela Universidade de Cincinnati, Shell sort é o mais eficiente algoritmo de classificação dentre os de complexidade quadrática. É um refinamento do método de inserção direta. O algoritmo difere do método de inserção direta pelo fato de no lugar de considerar o array a ser ordenado como um único segmento, ele considera vários segmentos sendo aplicado o método de inserção direta em cada um deles. Basicamente o algoritmo passa várias vezes pela lista dividindo o grupo maior em menores. Nos grupos menores é aplicado o método da ordenação por inserção. Implementações do algoritmo. Veja a versão em inglês desse mesmo link.
Abstract from DBpedia / Wikipedia · CC BY-SA