Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,51 @@
|
|||
/* NetRexx */
|
||||
|
||||
options replace format comments java crossref savelog symbols binary
|
||||
|
||||
placesList = [String -
|
||||
"UK London", "US New York" -
|
||||
, "US Boston", "US Washington" -
|
||||
, "UK Washington", "US Birmingham" -
|
||||
, "UK Birmingham", "UK Boston" -
|
||||
]
|
||||
sortedList = combSort(String[] Arrays.copyOf(placesList, placesList.length))
|
||||
|
||||
lists = [placesList, sortedList]
|
||||
loop ln = 0 to lists.length - 1
|
||||
cl = lists[ln]
|
||||
loop ct = 0 to cl.length - 1
|
||||
say cl[ct]
|
||||
end ct
|
||||
say
|
||||
end ln
|
||||
|
||||
return
|
||||
|
||||
method combSort(input = String[]) public constant binary returns String[]
|
||||
|
||||
swaps = isTrue
|
||||
gap = input.length
|
||||
loop label comb until gap = 1 & \swaps
|
||||
gap = int gap / 1.25
|
||||
if gap < 1 then
|
||||
gap = 1
|
||||
i_ = 0
|
||||
swaps = isFalse
|
||||
loop label swaps until i_ + gap >= input.length
|
||||
if input[i_].compareTo(input[i_ + gap]) > 0 then do
|
||||
swap = input[i_]
|
||||
input[i_] = input[i_ + gap]
|
||||
input[i_ + gap] = swap
|
||||
swaps = isTrue
|
||||
end
|
||||
i_ = i_ + 1
|
||||
end swaps
|
||||
end comb
|
||||
|
||||
return input
|
||||
|
||||
method isTrue public constant binary returns boolean
|
||||
return 1 == 1
|
||||
|
||||
method isFalse public constant binary returns boolean
|
||||
return \isTrue
|
||||
Loading…
Add table
Add a link
Reference in a new issue