Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,56 @@
/* NetRexx */
options replace format comments java crossref savelog symbols binary
import java.util.List
placesList = [String -
"UK London", "US New York", "US Boston", "US Washington" -
, "UK Washington", "US Birmingham", "UK Birmingham", "UK Boston" -
]
lists = [ -
placesList -
, selectionSort(String[] Arrays.copyOf(placesList, placesList.length)) -
]
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 selectionSort(a = String[]) public constant binary returns String[]
rl = String[a.length]
al = List selectionSort(Arrays.asList(a))
al.toArray(rl)
return rl
method selectionSort(a = List) public constant binary returns ArrayList
ra = ArrayList(a)
n = ra.size
iPos = int
iMin = int
loop iPos = 0 to n - 1
iMin = iPos
loop i_ = iPos + 1 to n - 1
if (Comparable ra.get(i_)).compareTo(Comparable ra.get(iMin)) < 0 then do
iMin = i_
end
end i_
if iMin \= iPos then do
swap = ra.get(iPos)
ra.set(iPos, ra.get(iMin))
ra.set(iMin, swap)
end
end iPos
return ra