Jump to content

Sorting algorithms/Bubble sort: Difference between revisions

Line 3,158:
:DelVar O
:Return
 
Implementation of the pseudo code given at the top of the page. Place data to be sorted in L<sub>1</sub>
:dim(L<sub>1</sub>)→D
:Repeat C=0
:0→C
:D–1→D
:For(I,1,D)
:If L<sub>1</sub>(I)>L<sub>1</sub>(I+1):Then
:L<sub>1</sub>(I)→C
:L<sub>1</sub>(I+1)→L<sub>1</sub>(I)
:C→L<sub>1</sub>(I+1)
:1→C
:End
:End
:End
:L<sub>1</sub>
 
=={{header|Tcl}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.