Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,29 @@
function flip(sequence s, integer n)
for i=1 to floor(n/2) do
{s[i],s[n-i+1]} = {s[n-i+1],s[i]}
end for
return s
end function
function pancake_sort(sequence s)
integer m
for i=length(s) to 2 by -1 do
m = 1
for j=2 to i do
if s[j]>s[m] then
m = j
end if
end for
if m<i then
if m>1 then
s = flip(s,m)
end if
s = flip(s,i)
end if
end for
return s
end function
constant s = shuffle(tagset(10))
? s
? pancake_sort(s)