The prevperm takes as argument a permutation. prevperm returns the previous permutation in lexicographic order, or undef if there is no previous permutation. Input:
Output: