Sorting algorithms/Bubble sort: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed some comments and added whitespace.) |
m (→{{header|REXX}}: use better indentation for a DO group.) |
||
Line 3,083: | Line 3,083: | ||
do j=1 for n-1 /*sort M items this time around. */ |
do j=1 for n-1 /*sort M items this time around. */ |
||
k=j+1 /*point to the next item. */ |
k=j+1 /*point to the next item. */ |
||
if @.j>@.k then do |
if @.j>@.k then do /*is it out of order? */ |
||
_=@.j |
_=@.j /*assign to a temp variable. */ |
||
@.j=@.k |
@.j=@.k /*swap current with next. */ |
||
@.k=_ |
@.k=_ /*··· and next with _ */ |
||
done=0 |
done=0 /*indicate it's not done, */ |
||
end /* 1=true 0=false */ |
|||
end /*j*/ |
|||
end /*j*/ |
end /*j*/ |
||
end /*until done*/ |
end /*until done*/ |