Expanding a little on the OP's problem, here is an alternative method based on pattern matching:
SeedRandom[1]
set = RandomInteger[100, 5]
Cases[Permutations[set, {3}], {___, x_, ___, y_, ___, z_, ___} /; x > y > z]
Here is the set:
{80, 14, 0, 67, 3}
And here are the desired permutations:
{ {80, 14, 0}, {80, 14, 3}, {80, 67, 14}, {80, 67, 0}, {80, 67, 3}, {80, 3, 0}, {14, 3, 0}, {67, 14, 0}, {67, 14, 3}, {67, 3, 0} }
This method does not require the original list to be sorted, whereas kguler's does as it is currently written (although of course that would be trivially easy to do). Of course, that is not an issue in the specific case proposed by the OP, since the OP's list is in fact already sorted.
Of course, either method produces the same results:
set = Range[5];
Sort@Cases[Permutations[set, {3}], {___, x_, ___, y_, ___, z_, ___} /; x > y > z];
Sort@(Reverse /@ Subsets[set, {3}]);
% == %%
(*Out: True *)
PermutationsthanSubsets(which leads to about 10x increase inTimingforRange[200]even without the selection part). Then, you need to process this huge set to find the right elements -- which, in turn, takes ~10x the time it takes to construct thePermutations. – kglr May 19 '15 at 22:00