Sorting algorithms/Bubble sort: Difference between revisions

Line 6,517:
end
</syntaxhighlight>
 
=={{header|RPL}}==
The bubble algorithm is slow by construction, but since its RPL implementation uses basic stack handling, it is actually quicker than algorithms that work directly on the array.
{{works with|Halcyon Calc|4.2.7}}
≪ '''IF''' DUP SIZE 2 ≥ '''THEN'''
LIST→ → len
≪ len 1 '''FOR''' n
1 n 1 - '''START'''
'''IF''' DUP2 > '''THEN''' SWAP '''END'''
n ROLLD
'''NEXT'''
n ROLLD
-1 '''STEP'''
len →LIST
'''END''' ≫
 
=={{header|Ruby}}==
1,150

edits