Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,16 @@
func cocktailsort(a) {
var swapped = false;
func cmpsw(i) {
if (a[i] > a[i+1]) {
a[i, i+1] = a[i+1, i];
swapped = true;
}
}
var max = a.end;
do {
{ |i| cmpsw(i-1) } * max;
swapped.not! && break;
{ |i| cmpsw(max-i) } * max;
} while (swapped);
return a;
}

View file

@ -0,0 +1,5 @@
var numbers = [7,6,5,9,8,4,3,1,2,0];
say cocktailsort(numbers).dump;
var strs = ["John", "Kate", "Zerg", "Alice", "Joe", "Jane"];
say cocktailsort(strs).dump;