Sorting algorithms/Gnome sort: Difference between revisions
Content added Content deleted
imported>Chinhouse No edit summary |
(added Easylang) |
||
Line 1,256: | Line 1,256: | ||
? a |
? a |
||
# value: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].diverge()</syntaxhighlight> |
# value: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].diverge()</syntaxhighlight> |
||
=={{header|EasyLang}}== |
|||
{{trans|Lua}} |
|||
<syntaxhighlight> |
|||
proc sort . d[] . |
|||
i = 2 |
|||
j = 3 |
|||
while i <= len d[] |
|||
if d[i - 1] <= d[i] |
|||
i = j |
|||
j += 1 |
|||
else |
|||
swap d[i - 1] d[i] |
|||
i -= 1 |
|||
if i = 1 |
|||
i = j |
|||
j += 1 |
|||
. |
|||
. |
|||
. |
|||
. |
|||
data[] = [ 29 4 72 44 55 26 27 77 92 5 ] |
|||
sort data[] |
|||
print data[] |
|||
</syntaxhighlight> |
|||
=={{header|Eiffel}}== |
=={{header|Eiffel}}== |