在二叉树t中查找值为x的结点

来源:互联网 发布:澳门网络博客官方 编辑:程序博客网 时间:2024/04/29 23:26
void locate(BitTree t, int x)//在二叉树t中查找值为x的结点{BitTree p;p=t;if (t == NULL)printf("0\n");else if( t->data == x)printf("%d\n",p->data);else{ p=t->lchild;if (p)locate(t->lchild, x);elselocate(t->rchild, x);}}

原创粉丝点击