Gnome Sort in Redcode
1
An implementation of Gnome Sort in 9 lines of Redcode. Smaller and faster than Bubble Sort. Speed increase of .5x^2-2.5x over version 1.
; x elements sorted in min (2x-1), max ((9x^2-7x)/2) cycles
org inner
outer mov }p, temp
p mov FIRST+LENGTH-1, {p
nop >y, }p
mov temp, }p
sne y, #LENGTH
nop <y, {p
inner slt *p, {p
y djn inner, #LENGTH-1
jmn outer, y






There are currently no comments for this snippet.