Let's say I am to sort a bookcase given a certain sorting condition, for instance alphabetically. I am looking for a way to generate a step-by-step guide on how to do this sorting based on the original order, as well as the final order. 

Original order:

B C A D


Final order:

A B C D


Generated step by step instructions (by index):

0 -&gt; 2
0 -&gt; 2


The problem is, of course, each step will alter the sorting order, requiring the algorithm to take into account the new state of each order. 

Is there such an algorithm readily available?


Question: Should I tell other interviewers where else I've interviewed?
Answer: If you don't want to disclose that, you can simply say: "I'd rather not discuss this", and you can look straight into your interviewer eyes with that. I've seen candidates do that; it may have looked harsh, but there's no obligation on the candidate's side to tell anything beyond the contents of the job talk.

You can also try to convert this into a joke like "Enough to earn me a free roundtrip this year". An American faculty should take that as a hint that you don't want to talk about it. An international faculty may need a more straight answer like the one I gave above. (I am talking about the US here as the largest academic market; in UK, as far as I understand, you won't have more than 30 minutes face time with the faculty of the hiring institution, and they probably have more important things to ask than the # of interviews you have.)

Having said that, you need to weight in the benefits of telling vs. not. For one thing, you may not have all the invitations out yet on your first fly-out, so you really don't know yet what other interviews you might have. On the other hand, by the time you reach your sixth destination (if you are lucky to get that many), the first place may already have told you, "Sorry, we made the offer to somebody else". So nominally you may have interviewed there, but really you won't get an offer from them.

As a bottom line, you need to do what others in your discipline do. You don't want to look like a fool in the environment where everybody keep their secrets by telling left and right about your choosing between Harvard and Stanford (and thus losing a chance to get a far more realistic offer from Alabama); and you don't want to look like a fool hinting at many undisclosed interviews when your adviser had told them that this is the only interview you have when they called him/her, or your other interviews were posted on a job market rumor website.