Talk:Dutch national flag problem

From Rosetta Code

Flag request

This task needs a picture of the Dutch national flag. --Paddy3118 09:34, 1 July 2012 (UTC)

Algorithms

I kinda ducked the issue of optimized algorithms in favour of giving an answer in keeping with how things would be done idiomatically in a language. This shouldn't stop those who want to give famous algorithms as well though. --Paddy3118 09:34, 1 July 2012 (UTC)

"ensuring that they are not in the order of the Dutch national flag"

Please ensure that entries check for this too. (J language?). --Paddy3118 22:01, 1 July 2012 (UTC)

That's a low probability event for any reasonably sized collection of balls, so I did it manually in the example. If you want it automatic, replacing ? with (3||.@/:)^:(-:/:~)@:? will work unless the user tries to generate a selection of only one random ball. [I fussed with that one a bit -- the issue is that I wanted a single correction step for all the improbably things that could go wrong in a random sort.] --Rdm 00:58, 2 July 2012 (UTC)