lz广工的书上有东海道货单号和这种题书上就有,,,不用抓人代笔..KeyType last=0;void OutX(BiTree t, KeyType x, KeyType &a, KeyType &b)/* a: Return the nearest and smaller value to x, *//* but return MINV if no the value in t. *//* b: Return the nearest and larger value to x. *//* but return MAXV if no the value in t. */ if(t->lchild) OutX(t->lchild,x,a,b); if(last<x&&t->data.key>=x) else if(t->data.key<x) a=t->data.key; if(last<=x&&t->data.key>x) last=t->data.key; if(t->rchild) OutX(t->rchild,x,a,b); if(a==32) a=MINV; if(b==32) b=MAXV;}我的方法比较取巧~还是5楼的好~不过也写出来给你参考一下~