all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,47 @@
|
|||
/* 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 -
|
||||
, insertionSort(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 insertionSort(A = String[]) public constant binary returns String[]
|
||||
|
||||
rl = String[A.length]
|
||||
al = List insertionSort(Arrays.asList(A))
|
||||
al.toArray(rl)
|
||||
|
||||
return rl
|
||||
|
||||
method insertionSort(A = List) public constant binary returns ArrayList
|
||||
|
||||
loop i_ = 1 to A.size - 1
|
||||
value = A.get(i_)
|
||||
j_ = i_ - 1
|
||||
loop label j_ while j_ >= 0
|
||||
if (Comparable A.get(j_)).compareTo(Comparable value) <= 0 then leave j_
|
||||
A.set(j_ + 1, A.get(j_))
|
||||
j_ = j_ - 1
|
||||
end j_
|
||||
A.set(j_ + 1, value)
|
||||
end i_
|
||||
|
||||
return ArrayList(A)
|
||||
Loading…
Add table
Add a link
Reference in a new issue