## Analysis of Shellsort and related algorithms (1996)

### Cached

### Download Links

- [thomas.baudel.name]
- [www.cs.princeton.edu]
- [www.cs.princeton.edu]
- DBLP

### Other Repositories/Bibliography

Venue: | ESA ’96: Fourth Annual European Symposium on Algorithms |

Citations: | 27 - 0 self |

### BibTeX

@INPROCEEDINGS{Sedgewick96analysisof,

author = {Robert Sedgewick},

title = {Analysis of Shellsort and related algorithms},

booktitle = {ESA ’96: Fourth Annual European Symposium on Algorithms},

year = {1996},

pages = {25--27},

publisher = {Springer}

}

### Years of Citing Articles

### OpenURL

### Abstract

This is an abstract of a survey talk on the theoretical and empirical studies that have been done over the past four decades on the Shellsort algorithm and its variants. The discussion includes: upper bounds, including linkages to number-theoretic properties of the algorithm; lower bounds on Shellsort and Shellsort-based networks; average-case results; proposed probabilistic sorting networks based on the algorithm; and a list of open problems. 1 Shellsort The basic Shellsort algorithm is among the earliest sorting methods to be discovered (by D. L. Shell in 1959 [36]) and is among the easiest to implement, as exhibited by the following C code for sorting an array a[l],..., a[r]: shellsort(itemType a[], int l, int r) { int i, j, h; itemType v;

### Citations

1332 |
Introduction to parallel algorithms and architectures: arrays, trees, hypercubes
- Leighton
- 1992
(Show Context)
Citation Context ... with ratio less than 1.22 . This seems to lead to simple probabilistic sorting networks with depth about 4lgN. These networks are far simpler than other probabilistic networks than have been defined =-=[21]-=-[22], but analytic verification that the networks sort with high probability has not been completed. Lemke developed a probabilistic model that explains some of the behavior, but the question of the e... |

724 |
The Art of Computer Programming, Volume 3: Sorting and Searching, Third Edition
- Knuth
- 1997
(Show Context)
Citation Context ...th, ... items, for i =0, 1,...,h− 1. This process is called h-sorting the file. Basic information about the algorithm and many of its properties may be found in algorithms textbooks, for example [9], =-=[17]-=-, and [30]. Some of this information is summarized in this paper. The performance of Shellsort depends on the increment sequence. The specific values used in the code above are explained below. The es... |

523 | Sorting Networks and their Applications
- Batcher
- 1968
(Show Context)
Citation Context ...bounds are quite large, and no optimal networks are known that are competitive with the network associated with Pratt’s increment sequence for Shellsort given above or the classical Batcher’s network =-=[3]-=-, which also has O � N(log N ) 2� compare-exchanges. Poonen’s bound is relevant to this problem, but Cypher proved a stronger result for networks: Shellsort networks with decreasing increments must ha... |

279 | An Introduction to the Analysis of Algorithms
- Sedgewick, Flajolet
- 2013
(Show Context)
Citation Context ...e Case Two-pass Shellsort, using just the increments h and 1, is closely related to the classical ballot problem, and the average running time for random permutations can be explicitly determined [17]=-=[33]-=-: Theorem (Knuth) Two-pass (h, 1) Shellsort uses 2N 2 /h+ √ πN 3 h comparisons to sort a random file of size N. Taking h = O � N 1/3� gives the result that Shellsort uses O � N 5/3� comparisons, on th... |

211 |
An O(n log n) sorting network
- AJTAI, KOMLOS, et al.
- 1983
(Show Context)
Citation Context ...r bound Θ(N log N) 2 /(log log N) 2 for the worst-case complexity of Shellsort. Ajtai, Komlós, and Szemérdi showed in 1983 that optimal sorting networks have O � N log N � compare-exchange operations =-=[1]-=-[2], but the constants involved in the upper bounds are quite large, and no optimal networks are known that are competitive with the network associated with Pratt’s increment sequence for Shellsort gi... |

174 | Tight Bounds on the Complexity of Parallel Sorting - Leighton - 1985 |

115 |
Sorting in c log n parallel steps
- Ajtai, Komlós, et al.
- 1983
(Show Context)
Citation Context ...er bound #(N log N) 2 /(log log N) 2 for the worst-case complexity of Shellsort. Ajtai, Komls, and Szemrdi showed in 1983 that optimal sorting networks have O N log N compare-exchange operations [1][=-=2]-=-, but the constants involved in the upper bounds are quite large, and no optimal networks are known that are competitive with the network associated with Pratt's increment sequence for Shellsort given... |

97 | Average-case analysis of algorithms and data structures - VITTER, FLAJOLET - 1990 |

40 |
On the linear Diophantine problem of Frobenius in three variables, Crelle 301
- Selmer, Beyer
- 1978
(Show Context)
Citation Context ...sort is O � N 4/3� for the increments 1 8 23 77 281 1073 4193 16577 ... 4 j+1 +3· 2 j +1. The proof technique involves a relationship to the Frobenius problem from number theory [4][5][10][12][16][24]=-=[34]-=-. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the set. This function arises... |

37 |
Algorithms in C++, 2nd Edition
- Sedgewick
- 1992
(Show Context)
Citation Context ...ems, for i =0, 1,...,h− 1. This process is called h-sorting the file. Basic information about the algorithm and many of its properties may be found in algorithms textbooks, for example [9], [17], and =-=[30]-=-. Some of this information is summarized in this paper. The performance of Shellsort depends on the increment sequence. The specific values used in the code above are explained below. The essential po... |

36 |
Sorting in c log n parallel steps, Combinatorica 3
- Ajtai, Komlós, et al.
- 1983
(Show Context)
Citation Context ...ound Θ(N log N) 2 /(log log N) 2 for the worst-case complexity of Shellsort. Ajtai, Komlós, and Szemérdi showed in 1983 that optimal sorting networks have O � N log N � compare-exchange operations [1]=-=[2]-=-, but the constants involved in the upper bounds are quite large, and no optimal networks are known that are competitive with the network associated with Pratt’s increment sequence for Shellsort given... |

31 |
A high-speed sorting procedure
- Shell
- 1959
(Show Context)
Citation Context ...bilistic sorting networks based on the algorithm; and a list of open problems. 1 Shellsort The basic Shellsort algorithm is among the earliest sorting methods to be discovered (by D. L. Shell in 1959 =-=[36]-=-) and is among the easiest to implement, as exhibited by the following C code for sorting an array a[l], ..., a[r]: shellsort(itemType a[], int l, int r) { int i, j, h; itemType v; int incs[16] = { 13... |

26 |
A Linear Diophantine Problem
- Johnson
- 1960
(Show Context)
Citation Context ...n 1959 [36]) and is among the easiest to implement, as exhibited by the following C code for sorting an array a[l], ..., a[r]: shellsort(itemType a[], int l, int r) { int i, j, h; itemType v; int incs=-=[16]-=- = { 1391376, 463792, 198768, 86961, 33936, 13776, 4592, 1968, 861, 336, 112, 48, 21, 7, 3, 1 }; for ( k = 0; k < 16; k++) for (h = incs[k], i = l+h; i <= r; i++) { v = a[i]; j = i; while (j > h && a[... |

22 |
A (fairly) simple circuit that (usually) sorts
- Leighton, Plaxton
- 1990
(Show Context)
Citation Context ...h ratio less than 1.22 . This seems to lead to simple probabilistic sorting networks with depth about 4lgN. These networks are far simpler than other probabilistic networks than have been defined [21]=-=[22]-=-, but analytic verification that the networks sort with high probability has not been completed. Lemke developed a probabilistic model that explains some of the behavior, but the question of the exist... |

20 |
Shellsort and Sorting Networks
- Pratt
- 1971
(Show Context)
Citation Context ...d and 9-sorted can be 3-sorted in one insertion-sort pass, using just N comparisons. This generalizes to give a simple increment sequence with provable performance within a factor of log N of optimal =-=[28]-=-. Theorem (Pratt, 1971) The running time of Shellsort is Θ(N(log N ) 2 ) for the increments 1 2 3 4 6 9 8 12 18 27 16 24 36 54 81 .... The increment sequence is formed by starting at 1, then proceedin... |

18 |
Handbook of Algorithms and Data Structures, 2nd edition
- Gonnet, Baeza-Yates
- 1991
(Show Context)
Citation Context ... +2h)th, ... items, for i =0, 1,...,h− 1. This process is called h-sorting the file. Basic information about the algorithm and many of its properties may be found in algorithms textbooks, for example =-=[9]-=-, [17], and [30]. Some of this information is summarized in this paper. The performance of Shellsort depends on the increment sequence. The specific values used in the code above are explained below. ... |

18 |
Improved upper bounds on shellsort
- Incerpi, Sedgewick
(Show Context)
Citation Context ... linear combination of the integers in the set. This function arises in improving the bound in the second Lemma given above. Once the O � N 3/2� barrier was broken, further improvements soon followed =-=[14]-=-[35]: Theorem (Incerpi-Sedgewick, 1985; Selmer, 1987) There are increment sequences for which the running time of Shellsort is O � N 1+1/k� , using O � log N � increments. Selmer’s proof involves gene... |

11 |
A lower bound on the size of Shellsort sorting networks
- Cypher
- 1993
(Show Context)
Citation Context ...nen’s bound is relevant to this problem, but Cypher proved a stronger result for networks: Shellsort networks with decreasing increments must have Θ(N log N) 2 / log log N compare-exchange operations =-=[7]-=-. These theoretical results not only tell us that the Shellsort is nonoptimal, but also that any Shellsort using O � log N � increments must, for example, use Ω(N (log N) k ) comparisons for all k. Th... |

9 |
An analysis of (h; k; 1)-Shellsort
- Yao
- 1980
(Show Context)
Citation Context ...lts for the case where all the increments divide, but that case is not of practical interest. For three increments, an intricate argument by Yao gives an exact expression for the average running time =-=[43]-=-: Theorem (Yao) Three-pass (h, k, 1) Shellsort uses 2N 2 /h +( � πN 3 h/8 − � πN 3 /8h)/k + ψ(h, k)N comparisons to sort a random file of size N.s7 The definition for ψ(h, k) in this expression is ext... |

7 |
An ecient variation of Bubble Sort
- Dobosiewicz
- 1980
(Show Context)
Citation Context ...the O � N 5/3� worst case. Beyond these results, the analysis of the average-case of Shellsort for any increment sequence of practical interest is completely open. 5 Variants of Shellsort Dobosiewicz =-=[8]-=- was among the first to notice that using the Shellsort increments and basic structure, but substituting another operations for the full h-sort, may give an efficient way to sort random files. He prop... |

7 |
An empirical study of minimal storage sorting
- Hibbard
- 1963
(Show Context)
Citation Context ...ions until the 1-sort at the end. Early practitioners noticed this problem and the difficulty of precisely characterizing the running time of the method. The early studies of Shellsort are intriguing =-=[11]-=-[19], but we begin with theoretical results that were developed quite some time after Shellsort was invented [25][28]: Theorem (Papernov-Stasevich, 1965; Pratt, 1971) The running time of Shellsort is ... |

7 | Bad cases for Shaker-sort - Weiss, Sedgewick - 1988 |

6 |
A method for information sorting in computer memories, Problems Inform
- Papernov, Stasevich
(Show Context)
Citation Context ...terizing the running time of the method. The early studies of Shellsort are intriguing [11][19], but we begin with theoretical results that were developed quite some time after Shellsort was invented =-=[25]-=-[28]: Theorem (Papernov-Stasevich, 1965; Pratt, 1971) The running time of Shellsort is Θ(N 3/2 ) for the increments 1 3 7 15 31 63 127 255 511 ... The upper bound involves a tradeoff between two easy ... |

6 |
Practical variations of Shellsort
- Incerpi, Sedgewick
- 1987
(Show Context)
Citation Context ... h-bubble pass followed by a similar pass in the opposite direction, from right to left through the file, compare-exchanging each element with the one h to its left. This leads to a faster method [13]=-=[15]-=-: Empirical Result (Incerpi-Sedgewick, 1985) Replacing the h-sort in Shellsort by an h-shake pass gives an algorithm that nearly always sorts when the increment sequence is geometric, with ratio less ... |

5 |
personal communication
- Chazelle
- 2006
(Show Context)
Citation Context ...ple proof of the same asymptotic result, due to Chazelle, comes from generalizing Pratt’s O � N log 2 N � method: instead of using 2 and 3 to build the increment sequence, use α and (α+1) for fixed α =-=[6]-=-. The asymptotic worst-case running time works out to be 2 α2 N(log N) (lg α) 2 which is O� � 1+ɛ/ log N N for (lg α) 2 = O � log N � . This method also has too few small increments to be competitive ... |

5 |
The performance of randomized Shellsort-like network sorting algorithms SCAMP working paper P18/94, Institute for Defense Analysis
- Lemke
- 1994
(Show Context)
Citation Context ...+3h, i +5h, i +7h, ... are compare-exchanged with those in positions i +2h, i +4h, i +6h, i +8h, ...respectively. This can be done in two parallel steps, and seems sufficient to build useful networks =-=[23]-=-[32]: Empirical Result (Lemke, Sedgewick, 1994) Replacing the h-sort in Shellsort by an h-brick pass gives an algorithm that nearly always sorts when the increment sequence is geometric, with ratio le... |

5 | The worst case in Shellsort and related algorithms
- Poonen
- 1993
(Show Context)
Citation Context ...fact to be implied by a certain conjecture about inversions related to Frobenius patterns [38][41]. This result is implied by general bounds for Shellsort, which were proven soon thereafter by Poonen =-=[27]-=-. Theorem (Poonen) Shellsort requires at least N 1+c/√ M comparisons in the worst case to sort a file of size N in M passes, for some c>0. A simpler proof of this same result is given by Plaxton and S... |

4 |
An algorithm for a linear Diophantine equation and a problem of
- Greenberg
- 1980
(Show Context)
Citation Context ...ng time of Shellsort is O � N 4/3� for the increments 1 8 23 77 281 1073 4193 16577 ... 4 j+1 +3· 2 j +1. The proof technique involves a relationship to the Frobenius problem from number theory [4][5]=-=[10]-=-[12][16][24][34]. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the set. This... |

4 |
A high-speed sorting procedure
- Lazarus, Frank
- 1960
(Show Context)
Citation Context ... until the 1-sort at the end. Early practitioners noticed this problem and the difficulty of precisely characterizing the running time of the method. The early studies of Shellsort are intriguing [11]=-=[19]-=-, but we begin with theoretical results that were developed quite some time after Shellsort was invented [25][28]: Theorem (Papernov-Stasevich, 1965; Pratt, 1971) The running time of Shellsort is Θ(N ... |

4 |
Tight lower bounds for Shellsort
- Weiss, Sedgewick
- 1990
(Show Context)
Citation Context ... compute, uses relatively few (about log 3 N) increments, and does well in empirical studies. Later empirical studies have shown a ratio of about 11/5 to be the best for geometric increment sequences =-=[38]-=-[9].s4 Pratt’s proof seemed to apply to all the increment sequences of practical interest, and Knuth’s sequence works well in practice for moderate-sized sorting problems (and is still widely used tod... |

4 | Empirical study of the expected running time of Shellsort - Weiss - 1991 |

4 |
A method for information sorting in computer memories
- Papernov, Stasevich
- 1965
(Show Context)
Citation Context ...terizing the running time of the method. The early studies of Shellsort are intriguing [11][19], but we begin with theoretical results that were developed quite some time after Shellsort was invented =-=[25]-=-[28]: Theorem (Papernov-Stasevich, 1965; Pratt, 1971) The running time of Shellsort is #(N 3/2 ) for the increments 1 3 7 15 31 63 127 255 511 . . . The upper bound involves a tradeoff between two eas... |

2 |
A Study of the Worst Case of Shellsort
- Incerpi
- 1985
(Show Context)
Citation Context ...e an h-bubble pass followed by a similar pass in the opposite direction, from right to left through the file, compare-exchanging each element with the one h to its left. This leads to a faster method =-=[13]-=-[15]: Empirical Result (Incerpi-Sedgewick, 1985) Replacing the h-sort in Shellsort by an h-shake pass gives an algorithm that nearly always sorts when the increment sequence is geometric, with ratio l... |

2 |
On Shellsort and the Frobenius problem
- Selmer
- 1987
(Show Context)
Citation Context ...ear combination of the integers in the set. This function arises in improving the bound in the second Lemma given above. Once the O � N 3/2� barrier was broken, further improvements soon followed [14]=-=[35]-=-: Theorem (Incerpi-Sedgewick, 1985; Selmer, 1987) There are increment sequences for which the running time of Shellsort is O � N 1+1/k� , using O � log N � increments. Selmer’s proof involves generali... |

1 |
On a problem of partitiions
- Brauer
- 1942
(Show Context)
Citation Context ... running time of Shellsort is O � N 4/3� for the increments 1 8 23 77 281 1073 4193 16577 ... 4 j+1 +3· 2 j +1. The proof technique involves a relationship to the Frobenius problem from number theory =-=[4]-=-[5][10][12][16][24][34]. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the se... |

1 |
Solution to Problem 7382
- Curran-Sharp
(Show Context)
Citation Context ...nning time of Shellsort is O � N 4/3� for the increments 1 8 23 77 281 1073 4193 16577 ... 4 j+1 +3· 2 j +1. The proof technique involves a relationship to the Frobenius problem from number theory [4]=-=[5]-=-[10][12][16][24][34]. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the set. ... |

1 |
Zu einem Problem von Frobenius,” Norske Vid
- Hofmeister
- 1966
(Show Context)
Citation Context ...ime of Shellsort is O � N 4/3� for the increments 1 8 23 77 281 1073 4193 16577 ... 4 j+1 +3· 2 j +1. The proof technique involves a relationship to the Frobenius problem from number theory [4][5][10]=-=[12]-=-[16][24][34]. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the set. This fun... |

1 |
On a linear diophantine problem
- Lewin
- 1973
(Show Context)
Citation Context ...hellsort is O � N 4/3� for the increments 1 8 23 77 281 1073 4193 16577 ... 4 j+1 +3· 2 j +1. The proof technique involves a relationship to the Frobenius problem from number theory [4][5][10][12][16]=-=[24]-=-[34]. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the set. This function ar... |

1 |
Improved lower bounds for Shellsort,” J. of Algorithms, to appear. Preliminary version
- Plaxton, Suel
- 1992
(Show Context)
Citation Context ...eorem (Poonen) Shellsort requires at least N 1+c/√ M comparisons in the worst case to sort a file of size N in M passes, for some c>0. A simpler proof of this same result is given by Plaxton and Suel =-=[26]-=-. Taking M = Ω(log N) shows that the Incerpi-Sedgewick or Chazelle constructions are optimal for short increment sequences, and taking M to be slightly larger gives the lower bound Θ(N log N) 2 /(log ... |

1 |
Experiments with shaker sort on the CRAY-2,” SCAMP working paper no. 22/89, Institute for Defense Analyses
- Robbins
(Show Context)
Citation Context ...(Incerpi-Sedgewick, 1985) Replacing the h-sort in Shellsort by an h-shake pass gives an algorithm that nearly always sorts when the increment sequence is geometric, with ratio less than 1.7 . Robbins =-=[29]-=- found this method to be among the fastest for a certain range of file sizes on a vector supercomputer; Weiss [38] also validated this result with extensive simulations. Both of these methods also def... |

1 |
Bricksort networks
- Sedgewick
(Show Context)
Citation Context ... i +5h, i +7h, ... are compare-exchanged with those in positions i +2h, i +4h, i +6h, i +8h, ...respectively. This can be done in two parallel steps, and seems sufficient to build useful networks [23]=-=[32]-=-: Empirical Result (Lemke, Sedgewick, 1994) Replacing the h-sort in Shellsort by an h-brick pass gives an algorithm that nearly always sorts when the increment sequence is geometric, with ratio less t... |

1 | More on Shellsort increment sequences - Weiss, Sedgewick - 1990 |

1 |
Solution to Problem 7382 (Mathematics
- Curran-Sharp
(Show Context)
Citation Context ...ing time of Shellsort is O N 4/3 for the increments 1 8 23 77 281 1073 4193 16577 . . . 4 j+1 + 3s2 j + 1. The proof technique involves a relationship to the Frobenius problem from number theory [4][=-=5]-=-[10][12][16][24][34]. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the set. ... |

1 |
Zu einem Problem von Frobenius," Norske Vid
- Hofmeister
- 1966
(Show Context)
Citation Context ...e of Shellsort is O N 4/3 for the increments 1 8 23 77 281 1073 4193 16577 . . . 4 j+1 + 3s2 j + 1. The proof technique involves a relationship to the Frobenius problem from number theory [4][5][10][=-=12]-=-[16][24][34]. The Frobenius number for a set of distinct integers is defined to be the number of positive integers that cannot be expressed as a linear combination of the integers in the set. This fun... |

1 |
Improved lower bounds for Shellsort," J. of Algorithms, to appear. Preliminary version
- Plaxton, Suel
- 1992
(Show Context)
Citation Context ...em (Poonen) Shellsort requires at least N 1+c/ # M comparisons in the worst case to sort a file of size N in M passes, for some c > 0. A simpler proof of this same result is given by Plaxton and Suel =-=[26]-=-. Taking M = ##478 N) shows that the Incerpi-Sedgewick or Chazelle constructions are optimal for short increment sequences, and taking M to be slightly larger gives the lower bound #(N log N) 2 /(log ... |

1 |
Experiments with shaker sort on the CRAY-2," SCAMP working paper no. 22/89, Institute for Defense Analyses
- Robbins
(Show Context)
Citation Context ...(Incerpi-Sedgewick, 1985) Replacing the h-sort in Shellsort by an h-shake pass gives an algorithm that nearly always sorts when the increment sequence is geometric, with ratio less than 1.7 . Robbins =-=[29]-=- found this method to be among the fastest for a certain range of file sizes on a vector supercomputer; Weiss [38] also validated this result with extensive simulations. Both of these methods also def... |