Anonymous user
Best shuffle: Difference between revisions
m
→Deterministic List-based solution
(→{{header|Haskell}}: Changed to correct and efficient solution) |
|||
Line 1,589:
The core of the algorithm is swapping procedure similar to those implemented in AWK and Icon examples. It could be done by a pure program with use of immutable vectors (though it is possible to use mutable vectors living in <tt>ST</tt> or <tt>IO</tt>, but it won't make the program more clear).
<lang Haskell>import Data.Vector ((//), (!)
import qualified Data.Vector as V
import Data.List (delete, find)
Line 1,648:
"Rosetta Code is a programming chrestomathy site." " Rmoisnegt tcahmrCeosdteo miast hay psriotger.a" 0</pre>
That's much better.
=== Nondeterministic List-based solution ===
|