Sorting algorithms/Bubble sort: Difference between revisions
Content added Content deleted
(→{{header|BASIC}}: Clarified implementation of BASIC: QuickBASIC.) |
Jazzedpineda (talk | contribs) (Added EasyLang implementation) |
||
Line 2,820: | Line 2,820: | ||
(Uses the primitive __loop directly because it happens to map to the termination test for this algorithm well.) |
(Uses the primitive __loop directly because it happens to map to the termination test for this algorithm well.) |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight lang="easylang"> |
|||
func bubbleSort . array[] . |
|||
repeat |
|||
itemCount = len array[] |
|||
if itemCount <= 1 |
|||
break 2 |
|||
. |
|||
hasChanged$ = "false" |
|||
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" |
|||
. |
|||
. |
|||
array[] = [ 5 1 19 25 12 1 14 7 ] |
|||
call bubbleSort array[] |
|||
print array[] |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre>[ 1 1 5 7 12 14 19 25 ]</pre> |
|||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |