Permutation Sort Algorithm Very Slow
Agora via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 7 14:40:07 PDT 2014
Hi.
I've found some code
import std.stdio, std.algorithm;
void permutationSort(T)(T[] items) pure nothrow {
while (items.nextPermutation) {}
}
void main() {
auto data = [2, 7, 4, 3, 5, 1, 0, 9, 8, 6, -1];
data.permutationSort;
data.writeln;
}
This code is running very slow
Runtime Seconds: 5-6
Why is running slow?
Sorry for my bad english :( :)
Thank you :)
More information about the Digitalmars-d-learn
mailing list