Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
import std.stdio, std.algorithm, permutations2;
|
||||
|
||||
void permutationSort(T)(T[] items) pure nothrow @safe @nogc {
|
||||
foreach (const perm; items.permutations!false)
|
||||
if (perm.isSorted)
|
||||
break;
|
||||
}
|
||||
|
||||
void main() {
|
||||
auto data = [2, 7, 4, 3, 5, 1, 0, 9, 8, 6, -1];
|
||||
data.permutationSort;
|
||||
data.writeln;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import std.stdio, std.algorithm;
|
||||
|
||||
void permutationSort(T)(T[] items) pure nothrow @safe @nogc {
|
||||
while (items.nextPermutation) {}
|
||||
}
|
||||
|
||||
void main() {
|
||||
auto data = [2, 7, 4, 3, 5, 1, 0, 9, 8, 6, -1];
|
||||
data.permutationSort;
|
||||
data.writeln;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue