[racket] Knuth's algorithm S

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Sun Mar 9 13:13:32 EDT 2014

On Sun, 09 Mar 2014 13:00:04 -0400
Neil Van Dyke <neil at neilvandyke.org> wrote:

> Manfred Lotz wrote at 03/09/2014 12:34 PM:
> [...]
> > I had a look at the implementations of Knuth's algorithm S at
> > rosetta code: http://rosettacode.org/wiki/Knuth's_algorithm_S#Racket
> >    
> [...]
> Without profiling or trying to understand the code:
> * Is all that vector copying really necessary?
> * Are all the make-vector calls necessary?

Not sure if it could be improved upon. There is a certain way the
algorithm should be implemented (given at the top of the page).

> * Does that hash need to be a hash, or can it be a vector?

The hash  could be a vector, and IMHO should be a vector. Makes it
some 20% faster..


Posted on the users mailing list.