Idempotent partition around median of 5?
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Sat Feb 6 08:16:20 PST 2016
On 2/6/16 9:26 AM, Timon Gehr wrote:
> [1] This seems to be the shortest code that satisfies the specification
> I have given (<=6 comparisons, optimal number of swaps) for permutations
> and that performs all the comparing before all the swapping:
Thanks. Tried this just now, it's better than the pre-discussion
baselines but Ivan's still beats it (by a little). Then I just tried
tn's partition5c which beats Ivan's.
I should also add that returns are starting to diminish. Idempotence did
make a large difference. Then reducing max swaps made a smaller
difference (at least for the uints I'm working with).
BTW my testbed is a careful implementation of BFPRT on random arrays of
uint of various sizes.
Andrei
More information about the Digitalmars-d
mailing list