Given a 5-element array of digits (1,2,3,4,5)
Describe an algorithm (and/or write the code) to generate the "next" permutation for a given permutation.
Define the "next" permutation as the smallest number larger than the current number where a number is composed of the elements of the array...