September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,7 @@
|
|||
fcn pancakeSort(a){
|
||||
foreach i in ([a.len()-1..1,-1]){
|
||||
j := a.index((0).max(a[0,i+1])); // min for decending sort
|
||||
if(i != j){ a.swap(0,j); a.swap(0,i); }
|
||||
}
|
||||
a
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
j := (i+1).reduce('wrap(x,y){ if(a[x]>a[y]) x else y });
|
||||
|
|
@ -0,0 +1 @@
|
|||
pancakeSort(List(7,6,9,2,4,8,1,3,5)).println();
|
||||
Loading…
Add table
Add a link
Reference in a new issue