I am reading about permutation generation and relationship with Travelling Salesman Problem in Introduction to design and analysis of algorithms.
Here author mentioned as below
We can insert n in the previously generated permutations either left to right or right to left. It turns out that it is beneficial to start with inserting n into 12 . . . (n − 1) by moving right to left and then switch direction every time a new permutation of {1, . . . , n − 1} needs to be processed. The advantage of this order of generating permutations stems from the fact that it satisfies the minimal-change requirement: each permutation can be obtained from its immediate predecessor by exchanging just two elements in it.
If such permutations are generated by a minimal-change algorithm, we can compute the length of a new tour from the length of its predecessor in constant rather than linear time.
My question on above text: How can we calculate length form predecessor in constant time if we use minimum change algorithm? If possible, please give a simple example with n=3
.