Sorting algorithms/Patience sort: Difference between revisions

Content deleted Content added
SqrtNegInf (talk | contribs)
m →‎{{header|Perl}}: Fix link: Perl 6 --> Raku
Petelomax (talk | contribs)
m →‎{{header|Phix}}: pp_StrFmt tweaks
Line 785: Line 785:
end for
end for
-- merge sort the piles
-- merge sort the piles
sequence res = {}
sequence res = ""
while length(piles) do
while length(piles) do
integer idx = smallest(piles,return_index:=true)
integer idx = smallest(piles,return_index:=true)
Line 804: Line 804:


for i=1 to length(tests) do
for i=1 to length(tests) do
pp(patience_sort(tests[i]),{pp_StrFmt,-2})
pp(patience_sort(tests[i]),{pp_IntCh,false})
end for</lang>
end for</lang>
{{out}}
{{out}}
Line 810: Line 810:
{-31,0,1,2,4,65,83,99,782}
{-31,0,1,2,4,65,83,99,782}
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
"emnnoorsuz"
`emnnoorsuz`
{"ant", "ape", "ass", "cat", "cow", "dog", "gnu", "man", "pig"}
{`ant`, `ape`, `ass`, `cat`, `cow`, `dog`, `gnu`, `man`, `pig`}
</pre>
</pre>