Question: Course: Combinatorics Use C language for this problem Description: Switch adjacent is an order to list all n-permutations. In switch adjacent order, each permutation is
Course: Combinatorics
Use C language for this problem 
Description: Switch adjacent is an order to list all n-permutations. In switch adjacent order, each permutation is obtained from the preceding one by switching two adjacent numbers. For example, switch adjacent order for 3-permutation is 123, 132,3 12,32 1,23 1, 2 13. Given positive integers n and k, output the kth permutation in switch adjacent order. For example, let n = 3, k=2, the answer is 13 2. Input The first row is a positive integer m, which is the number of test cases. It is followed by m test cases. Each test case has one line with two positive integers n( 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
