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


Quad trie search


search( key, t ) typekey key[K]; tree t; {int bn, i, indx; for ( bn=1; t != NULL && !IsData(t); bn++ ) { indx = 0; for (i=0; i<K; i++) indx = 2*indx + bit(bn,key[i]); t = t->p[indx]; } if ( t != NULL ) for (i=0; i<K && key[i]==t->k[i]; i++); if ( t==NULL || i < K ) notfound( key ); else found( t ); };

C source (351b.srch.c)



© Addison-Wesley Publishing Co. Inc.