[Home]
[Contents]
[Chapter]
[Previous Algorithm]
[Next Algorithm]


Range search in k-d trees


rsearch( lowk, uppk, t, lev ) typekey lowk[], uppk[]; tree t; int lev; {int j; if ( t==NULL ) return; if ( lowk[lev] <= t->k[lev] ) rsearch( lowk, uppk, t->left, (lev+1)%K ); for ( j=0; j<K && lowk[j]<=t->k[j] && uppk[j]>=t->k[j]; j++ ); if ( j==K ) found( t ); if ( uppk[lev] > t->k[lev] ) rsearch( lowk, uppk, t->right, (lev+1)%K ); };

C source (352.range.c)



© Addison-Wesley Publishing Co. Inc.