-
Notifications
You must be signed in to change notification settings - Fork 0
/
gap sequences.R
32 lines (27 loc) · 1.08 KB
/
gap sequences.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#gap sequences
SE86_ <- c(1, 5, 19, 41, 109, 209, 505, 929, 2161, 3905, 8929, 16001, 36289, 64769, 146305, 260609, 587521, 1045505, 2354689, 4188161, 9427969)
TO92_ <- c(1, 4, 9, 20, 46, 103, 233, 525, 1182, 2660, 5985, 13467, 30301, 68178, 153401, 345152, 776591, 1747331, 3931496, 8845866)
CI01_ <- c(1, 4, 10, 23, 57, 132, 301, 701, 1750)
SE86 <- function(s){
gap <- c(1, 5, 19, 41, 109, 209, 505, 929, 2161, 3905, 8929, 16001, 36289, 64769, 146305, 260609, 587521, 1045505, 2354689, 4188161, 9427969)
ShellSort(s, Gaps = gap)
}
TO92 <- function(s){
gap <- c(1, 4, 9, 20, 46, 103, 233, 525, 1182, 2660, 5985, 13467, 30301, 68178, 153401, 345152, 776591, 1747331, 3931496, 8845866)
ShellSort(s, Gaps = gap)
}
CI01 <- function(s){
gap <- c(1, 4, 10, 23, 57, 132, 301, 701, 1750, 3937, 8858, 19930, 44842, 100894, 227011, 510774, 1149241, 2585792, 5818032)
ShellSort(s, Gaps = gap)
}
GB91 <- function(s) {
gap <- numeric(0)
N = length(s)
a = max(floor(5*N/11), 1)
while(a > 1){
gap = c(a, gap)
a = max(floor(5*a/11), 1)
}
gap = c(1, gap)
ShellSort(s, Gaps = gap)
}