Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
shellSort[ lst_ ] := Module[ {list = lst, incr, temp, i, j},
|
||||
incr = Round[Length[list]/2];
|
||||
While[incr > 0,
|
||||
|
||||
For[i = incr + 1, i <= Length[list], i++,
|
||||
|
||||
temp = list[[i]]; j = i;
|
||||
|
||||
While[(j >= (incr + 1)) && (list[[j - incr]] > temp) ,
|
||||
list[[j]] = list[[j - incr]]; j = j-incr;
|
||||
];
|
||||
|
||||
list[[j]] = temp;];
|
||||
If[incr == 2, incr = 1, incr = Round[incr/2.2]]
|
||||
]; list
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue