Sorting algorithms/Gnome sort: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring the hard way) |
Drkameleon (talk | contribs) |
||
Line 562: | Line 562: | ||
arr: new items |
arr: new items |
||
while [i < size arr][ |
while [i < size arr][ |
||
if? |
if? arr\[i-1] =< arr\[i] [ |
||
i: j |
i: j |
||
j: j + 1 |
j: j + 1 |
||
] |
] |
||
else [ |
else [ |
||
tmp: arr |
tmp: arr\[i] |
||
arr\[i]: arr\[i-1] |
|||
arr\[i-1]: tmp |
|||
i: i-1 |
i: i-1 |
||
if i=0 [ |
if i=0 [ |