On 02/04/2016 03:30 PM, Timon Gehr wrote:
At most 6 comparisons, <=3 swaps, idempotent (optimal number of swaps):
Timon, Ivan, this is amazing work. I don't know how your minds work folks - I sat for like two hours on it yesterday and couldn't crack it.
Surprisingly in a test on millions of random numbers, Ivan's version wins by a hair. Might be the tighter code which has icache effects.
Thanks very much! I should say that at these point no better definitions can be found on the Net.
Andrei