September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,13 @@
|
|||
fcn bubbleSort(list){
|
||||
itemCount := list.len();
|
||||
do{
|
||||
hasChanged := False;
|
||||
foreach index in (itemCount -= 1){
|
||||
if (list[index] > list[index + 1]){
|
||||
list.swap(index,index + 1);
|
||||
hasChanged = True;
|
||||
}
|
||||
}
|
||||
}while(hasChanged);
|
||||
list
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
fcn bubbleSort(list){
|
||||
foreach n,index in ([list.len()-1..0,-1],n){
|
||||
if (list[index] > list[index + 1]) list.swap(index,index + 1);
|
||||
}
|
||||
list
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
bubbleSort("This is a test".split("")).println();
|
||||
Loading…
Add table
Add a link
Reference in a new issue