Jump to content

Sorting algorithms/Gnome sort: Difference between revisions

Added 11l
(Added Quackery)
(Added 11l)
Line 30:
Implement the Gnome sort in your language to sort an array (or list) of numbers.
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>F gnomesort(&a)
V i = 1
V j = 2
L i < a.len
I a[i - 1] <= a[i]
i = j
j++
E
swap(&a[i - 1], &a[i])
i--
I i == 0
i = j
j++
R a
 
print(gnomesort(&[3, 4, 2, 5, 1, 6]))</lang>
 
{{out}}
<pre>
[1, 2, 3, 4, 5, 6]
</pre>
 
=={{header|360 Assembly}}==
Line 92 ⟶ 117:
-764 557 1485 1845 2045 2555 2625 2874 2963 3499 3522 3598 4175 4350 4891 4992 5044 5143 5432 5792 6798 6817 6949 7562 8264
</pre>
 
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
1,481

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.