/* ECP: FILEname=fig11_15.c */ /* 1*/ /* Return A Pointer To Node Storing X if X Is Found */ /* 2*/ TreeNode * /* 3*/ Find( const Tree Root, const char *X ) /* 4*/ { /* 5*/ int Cmp; /* 6*/ if( Root == NULL ) /* Not Found */ /* 7*/ return NULL; /* 8*/ if( ( Cmp = strcmp( X, Root->Item ) ) < 0 ) /* 9*/ return Find( Root->Left, X ); /* X < Root->Item */ /*10*/ if( Cmp > 0 ) /*11*/ return Find( Root->Right, X ); /* X > Root->Item */ /*12*/ return Root->Count ? Root : NULL; /* X = Root->Item */ /*13*/ }