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,15 @@
permutationsort <- function(x)
{
if(!require(e1071) stop("the package e1071 is required")
is.sorted <- function(x) all(diff(x) >= 0)
perms <- permutations(length(x))
i <- 1
while(!is.sorted(x))
{
x <- x[perms[i,]]
i <- i + 1
}
x
}
permutationsort(c(1, 10, 9, 7, 3, 0))

View file

@ -0,0 +1,10 @@
library(RcppAlgos)
permuSort <- function(list)
{
iter <- permuteIter(list)
while(is.unsorted(iter$nextIter())){}#iter$nextIter advances iter to the next iteration and returns it.
iter$currIter()
}
test <- sample(10)
print(test)
permuSort(test)

View file

@ -0,0 +1,4 @@
repeat
{
if(!is.unsorted(iter$nextIter())) break
}