There are n students in a class . Each student is represented by their index i. Two students want to exchange their lunch given the student can only exchange their lunch with i/2th student. We have to
tell in how many minimum steps the two students can exchange their lunch. In the process other students can also exchange their lunch.
n–> no of students
i,j the index of student who want to exchange their lunch
print the minimum step required
2nd index student exchange with 1st student in one step.
Original order is (1,2,3)
3rd exchange with 1 (3,2,1)
2nd exchange with 1 (3,1,2)
3rd exchange with 1 (1,3,2)
The required order is(1,3,2)