Sorting algorithms/Bubble sort: Difference between revisions
m
→{{header|Standard ML}}: fix syntax highlighting
imported>LongPtrCall (Added GDScript implementation.) |
m (→{{header|Standard ML}}: fix syntax highlighting) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 3,525:
=={{header|Elena}}==
{{trans|C#}}
ELENA
<syntaxhighlight lang="elena">import system'routines;
import extensions;
Line 3,541:
madeChanges := false;
itemCount -= 1;
for(int i := 0
{
if (list[i] > list[i + 1])
Line 7,458:
=={{header|Standard ML}}==
Assumes a list of integers.
<syntaxhighlight lang="sml">
fun bubble_select [] = []
| bubble_select [a] = [a]
Line 7,466:
fun bubblesort [] = []
| bubblesort (x::xs) =bubble_select (x::(bubblesort xs))
</syntaxhighlight>
=={{header|Stata}}==
Line 7,778:
=={{header|Wren}}==
Based on the pseudo-code in the Wikipedia article.
<syntaxhighlight lang="
var n = a.count
if (n < 2) return
Line 7,795:
}
var
for (a in
System.print("Before: %(a)")
bubbleSort.call(a)
|