Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -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;
}

View file

@ -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;
}