Sorting algorithms/Bubble sort: Difference between revisions

Content added Content deleted
(Jakt)
Line 3,207: Line 3,207:
=={{header|EasyLang}}==
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
<syntaxhighlight lang="easylang">
func bubbleSort . array[] .
proc bubbleSort . a[] .
repeat
repeat
itemCount = len array[]
changed = 0
if itemCount <= 1
for i = 1 to len a[] - 1
break 2
if a[i] > a[i + 1]
swap a[i] a[i + 1]
.
hasChanged$ = "false"
changed = 1
itemCount -= 1
for index = 1 to itemCount
if array[index] > array[index + 1]
temp = array[index]
array[index] = array[index + 1]
array[index + 1] = temp
hasChanged$ = "true"
.
.
.
.
until hasChanged$ = "false"
until changed = 0
.
.
.
.