Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
procedure main() #: demonstrate various ways to sort a list and string
|
||||
demosort(insertionsort,[3, 14, 1, 5, 9, 2, 6, 3],"qwerty")
|
||||
end
|
||||
|
||||
procedure insertionsort(X,op) #: return sorted X
|
||||
local i,temp
|
||||
|
||||
op := sortop(op,X) # select how and what we sort
|
||||
|
||||
every i := 2 to *X do {
|
||||
temp := X[j := i]
|
||||
while op(temp,X[1 <= (j -:= 1)]) do
|
||||
X[j+1] := X[j]
|
||||
X[j+1] := temp
|
||||
}
|
||||
return X
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue