Sorting algorithms/Bubble sort: Difference between revisions
Content deleted Content added
Added a solution for MATLAB |
→{{header|MATLAB}}: Vectorized the swap operation |
||
Line 1,090: | Line 1,090: | ||
if(list(index) > list(index+1)) |
if(list(index) > list(index+1)) |
||
list([index index+1]) = list([index+1 index]); %swap |
|||
list(index) = list(index+1); |
|||
list(index+1) = temp; |
|||
hasChanged = true; |
hasChanged = true; |
||
end %if |
end %if |
||
Line 1,106: | Line 1,104: | ||
1 2 3 4 5 6 7 8 9</lang> |
1 2 3 4 5 6 7 8 9</lang> |
||
=={{header|MAXScript}}== |
=={{header|MAXScript}}== |