The permutation of {1,2,3,4,5} which follows 31524 and comes before 31524.
Expert Solution & Answer
Answer to Problem 1E
The permutation 31524 is followed by 35124_ and preceded by 31254_.
Explanation of Solution
Algorithm used:
Begin with 1←,2←,⋯,n←.
While there exists a mobile integer, do the following:
(1) Find the largest mobile integer m.
(2) Switch m and the adjacent integer to which its arrow points.
(3) Switch the direction of all the arrows above integers p with p>m.
Calculation:
The permutations of (1,2,3,4) are listed in 24 rows.
According to the algorithm mentioned above, for each row (1,2,3,.........24), insert 5 in the five possible locations of the given permutation, working from right to left for odd numbered rows and left to right for even numbered rows.
The permutation 3124 appears on row 9 which is odd and so, for this row the 5's are inserted from right to left.
Thus, the permutation 31524 is followed by 35124_ and preceded by 31254_.
Want to see more full solutions like this?
Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!