"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
>...
> // Insertion sort
> #for (I, 1, NoOfPoints)
> #local Key = Bins[I];
> #local TempF_0 = Points[I][0];
> #local TempF_1 = Points[I][1];
> #local J = I - 1;
> #local Continue = (Bins[J] > Key);
> #while (Continue)
> #local Bins[J+1] = Bins[J];
> #local Points[J+1][0] = Points[J][0];
> #local Points[J+1][1] = Points[J][1];
> #local J = J - 1;
> #local Continue = (J >= 0);
> #if (Continue)
> #local Continue = (Bins[J] > Key);
> #end // if
> #end // while
> #local Bins[J+1] = Key;
> #local Points[J+1][0] = TempF_0;
> #local Points[J+1][1] = TempF_1;
> #end // for
>...
If the assignments after the while loop goes wrong, then you can try
to change lines at the end of the while loop like this:
#local Continue = (J >= 1);
#if (Continue)
#local J = J - 1;
#local Continue = (Bins[J] > Key);
#end // if
--
Tor Olav
http://subcube.com
https://github.com/t-o-k
Post a reply to this message
|