[racket] Knuth's algorithm S
Manfred Lotz wrote at 03/09/2014 01:13 PM:
> There is a certain way the
> algorithm should be implemented (given at the top of the page).
>
I haven't traced through the algorithm completely (and I have to run out
the door now), but looks like you might be able to replace the
"(vector-copy vec)" with "vec". (At least for purposes of this
benchmark of 100,000 iterations; for a reusable library, you might not
do it that way, nor the way that rosettacode.org prescribes.)
On my computer, eliminating that one "vector-copy" from the code drops
run time down to 0.6 of what it is with your change. The output
distribution looks the same to me.
Neil V.