YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -0,0 +1,30 @@
flip := proc(arr, i)
local start, temp, icopy;
temp, start, icopy := 0,1,i:
while (start < icopy) do
arr[start], arr[icopy] := arr[icopy], arr[start]:
start:=start+1:
icopy:=icopy-1:
end do:
end proc:
findMax := proc(arr, i)
local Max, j:
Max := 1:
for j from 1 to i do
if arr[j] > arr[Max] then Max := j: end if:
end do:
return Max:
end proc:
pancakesort := proc(arr)
local len,i,Max;
len := numelems(arr):
for i from len to 2 by -1 do
print(arr):
Max := findMax(arr, i):
if (not Max = i) then
flip(arr, Max):
flip(arr, i):
end if:
end do:
print(arr);
end proc: