September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,20 +0,0 @@
|
|||
function list = bubbleSort(list)
|
||||
|
||||
hasChanged = true;
|
||||
itemCount = numel(list);
|
||||
|
||||
while(hasChanged)
|
||||
|
||||
hasChanged = false;
|
||||
itemCount = itemCount - 1;
|
||||
|
||||
for index = (1:itemCount)
|
||||
|
||||
if(list(index) > list(index+1))
|
||||
list([index index+1]) = list([index+1 index]); %swap
|
||||
hasChanged = true;
|
||||
end %if
|
||||
|
||||
end %for
|
||||
end %while
|
||||
end %bubbleSort
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
bubbleSort([5 3 8 4 9 7 6 2 1])
|
||||
|
||||
ans =
|
||||
|
||||
1 2 3 4 5 6 7 8 9
|
||||
Loading…
Add table
Add a link
Reference in a new issue