b) Scan from right to left and find the first element (first in right to left order) which is smaller than the next element (next in right to left order). Letebe the index of such an element. In the above example 1, e is 7 (index of 31). 2) Check whether sorting the candidate...
the smaller elements are always preferred. Input: [1,2,3,4,5], k=4, x=3 Output: [1,2...