Sorting algorithms/Cocktail sort: Difference between revisions

→‎{{header|Phix}}: bugfix, nothing like a copy any more
(→‎{{header|VBScript}}: ByVal needed)
(→‎{{header|Phix}}: bugfix, nothing like a copy any more)
Line 2,445:
 
=={{header|Phix}}==
Copy of [[Sorting_algorithms/Cocktail_sort#Euphoria|Euphoria]]
<lang Phix>function cocktail_sort(sequence s)
integer swapped = 1, f = 1, t = length(s)-1, d = 1
Line 2,458 ⟶ 2,457:
-- additionally, we can reduce one element to be
-- examined, depending on which way we just went.
{f,t,d} = {t-(d=1),f-(d=-1),-d}
end while
return s
7,794

edits