Sorting algorithms/Permutation sort: Difference between revisions

m
(→‎{{header|Prolog}}: Added PureBasic)
Line 669:
If pos < 0
reverse(0, elementCount)
ProcedureReturn #False ;no higher lexicologicallexicographic permutations left, return lowest one instead
EndIf
Wend
Line 682:
;Reverse the order of the elements in the higher positions
reverse(pos + 1, elementCount)
ProcedureReturn #True ;next lexicologicallexicographic permutation found
EndProcedure
 
Anonymous user