Sorting algorithms/Bubble sort: Difference between revisions

Content added Content deleted
No edit summary
Line 635: Line 635:
else liftM (x:) $ _bsort (x2:xs)
else liftM (x:) $ _bsort (x2:xs)
_bsort _ = Nothing</lang>
_bsort _ = Nothing</lang>

=={{header|HicEst}}==
<lang fortran>SUBROUTINE Bubble_Sort(a)
REAL :: a(1)
DO j = LEN(a)-1, 1, -1
swapped = 0
DO i = 1, j
IF (a(i) > a(i+1)) THEN
temp = a(i)
a(i) = a(i+1)
a(i+1) = temp
swapped = 1
ENDIF
ENDDO
IF (swapped == 0) RETURN
ENDDO
END</lang>


=={{header|J}}==
=={{header|J}}==