On Thursday, 4 February 2016 at 20:30:57 UTC, Timon Gehr wrote:
At most 6 comparisons, <=3 swaps, idempotent (optimal number of swaps):

void partition5(ref int[5] a){
  if(a[0]<a[1]){
...

Great, we can all go home!

I was curious so I did a crude measurement: when compiled for 64-bit with all optimizations turned on (-release -O -inline -boundscheck=off), the machine code for this function is about 3KB in size.

Reply via email to