Originally Posted by

**unleashed-my-freedom**
so we use temp just to increase the order by 1?

We use temp because otherwise you would loose a value. Think like you have two cups (A and B) in two positions (1 and 2 respectively) that each of them can place

__only one__ cup and you can carry only one cup in your hands. Now, if you want to exchange positions between cups you start like this:

take cup A and put it in position 1. But then you have to throw away cup B(because you can't have two cups in you a position or in your hands).

Therefore you need a new assisting position (3).

Then you put

1) cup A to position 3 - now position 1 is empty

2) cup B to position 1 - now position 2 is empty

3) cup A to position 2

So,

**temp** is the assisting position.

Hope that makes sense.