hey,
what is the algorithm used by ArraySort?
Bubble Sort?
Insertion Sort?
Merge Sort?
Quick Sort?
NXC: ArraySort algorithm?
Re: NXC: ArraySort algorithm?
http://en.wikipedia.org/wiki/Shellsort
John Hansen
Code: Select all
void shell_sort_flt(float* A, UWORD size)
{
UWORD i, j, increment;
float temp;
increment = size / 2;
while (increment > 0) {
for (i = increment; i < size; i++) {
j = i;
temp = A[i];
while ((j >= increment) && (A[j-increment] > temp)) {
A[j] = A[j - increment];
j = j - increment;
}
A[j] = temp;
}
if (increment == 2)
increment = 1;
else
increment = (UWORD)((float)increment / (float)2.2);
}
}
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests