Difference between revisions 8452434 and 8522129 on enwiki

'''Shell sort''' (or '''Shellsort''') is one of the oldest [[sorting algorithm|sorting algorithms]]. It was invented in 1959 by [[D. L. Shell|Donald L. Shell]] <nowiki>[</nowiki>[[#References|Sh]]<nowiki>]</nowiki>.
It is fast, easy to understand and easy to implement. 
However, its complexity analysis is a little more sophisticated.  
(contracted; show full)}</pre>

=== Using a list of shell sizes in C Edit By Z80user ===

table[]    is table to sort
table_size is ...
<pre>
int tabl
ea[]= {10,9,8,7,6,5,4,3,2,1};
int cols[]= {1391376,463792,198768,86961,33936,13776,4592,1968,861,336,112,48,21,7,3,1};
int table_size=10;                         // change it
int n,m,h,j,v;

for (n=0;n<16;n++)
    {
    h=cols[n];
    for (m=0;m<table_size;m++)
        {
        v=tabla[m];
        j=m;
        while (j>=h && tabla[t][j-h]>v)
            {
            tabla[j]^=tabla[j-h]; // Swap data 
            tabla[j-h]^=tabla[j]; // I Think java also need this change
            tabla[j]^=tabla[j-h]; // but i don`t have compiler of java
            j=j-h;
            }
        }
    tabla[j]=v;
    }
</pre>

==References==
[Se]  R. Sedgewick: Algorithms. Addison-Wesley (1988)<br>
[Sh]  D.L. Shell: A high-speed sorting procedure. Communications of the ACM 2 (7), 30-32 (1959)

== External links ==
*[http://www.iti.fh-flensburg.de/lang/algorithmen/sortieren/shell/shellen.htm Detailed analysis of Shell sort]
* [http://www.nist.gov/dads/HTML/shellsort.html Dictionary of Algorithms and Data Structures: Shellsort]

[[de:Shellsort]]
[[es:Ordenación Shell]]
[[nl:Shellsort]]
[[ja:&#12471;&#12455;&#12523;&#12477;&#12540;&#12488;]]

[[Category:Sort algorithms]]