Commit 33072400 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added kd_quick_sort().

parent 4a8cc96f
......@@ -123,6 +123,27 @@ _compPoints2(const void *p1, const void *p2)
return ret;
}
/*
void kd_quick_sort(struct kd_point *a, int n, int idx)
{
int i, j;
struct kd_point p, t;
if ( n < 2 ) return;
p = a[n / 2];
for ( i = 0, j = n - 1;; i++, j-- )
{
while ( a[i].point[idx] < p.point[idx] ) i++;
while ( p.point[idx] < a[j].point[idx] ) j--;
if ( i >= j ) break;
t = a[i];
a[i] = a[j];
a[j] = t;
}
kd_quick_sort(a, i, idx);
kd_quick_sort(a + i, n - i, idx);
}
*/
void *
kd_doBuildTree(void *threadarg)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment