Data Update

This commit is contained in:
Ingy döt Net 2023-07-18 13:51:12 -07:00
parent e50b5c3114
commit 633b36288a
206 changed files with 4762 additions and 965 deletions

View file

@ -1,14 +1,14 @@
func in_order(a) {
return true if (a.len <= 1);
var first = a[0];
a.ft(1).all { |elem| first <= elem ? do { first = elem; true } : false }
return true if (a.len <= 1)
var first = a[0]
a.last(-1).all { |elem| first <= elem  ? do { first = elem; true } : false }
}
func bogosort(a) {
a.shuffle! while !in_order(a);
return a;
a.shuffle! while !in_order(a)
return a
}
var arr = 5.of{ 100.rand.int };
say "Before: #{arr}";
say "After: #{bogosort(arr)}";
var arr = 5.of { 100.irand }
say "Before: #{arr}"
say "After: #{bogosort(arr)}"