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


Binary tree search (Pascal version available)


search( key, t ) typekey key; tree t; { while( t != NULL ) if ( t->k == key ) { found( t ); return; } else if ( t->k < key ) t = t->right; else t = t->left; notfound( key ); }

C source (3411.srch.c) Pascal source (3411.srch.p)



© Addison-Wesley Publishing Co. Inc.