Let you have an array $S[1 \dots n]$ and a function $reverse(s,i,j)$ which reverse the order of elements in $s$ between $i,j$-th positions. What does the following sequence do where $1\leq k\leq n$ ;
reverse(s,1,k) reverse (s,1,n) reverse(s,k+1,n)
Consider the array 2 3 4 8 5 and $k = 2$.
So none.
Sir,
The Question says - reverse the order of elements in s between i and j-th positions.So for swap do we include i and j positions as well or only the ones between them ?