möcht gerade meine Shell-Sortierroutine umschreiben, aber tut net was ich will.
Für Bubblesort hätt ich mehrere Beispiele gefunden aber das iss zu langsam. Die hier wäre mindestens 10x so schnell, wenn's funktionieren tät.
Gleich in der 1. Zeile kommt Fehler not a function, array, list, map or macro. Das hab ich ja auch net definiert.
Code: Alles auswählen
last = data(n(),1)
hops = int(last / 10) + 1
while(TRUE)
first = hops + 1
for count1 = first to last
buffer1 = n(count1)
count2 = count1 - hops
while(TRUE)
buffer2 = n(count2)
if buffer1 >= buffer2 then
count2 = count2 + hops
break
end if
n(count2+hops) = buffer2
if count2 <= hops then
break
end if
count2 = count2 - hops
wend
n(count2) = buffer1
next count1
if hops = 1 then
return
else
hops = int(hops / 3.5) + 1
end if
wend