试图为二叉树制作一个包含函数。二分查找树“包含”功能
功能如下:
bool contains(bt_node* top, int data) {
if (top == NULL) return false;
else {
if (data == top->data) return true;
else if (data < top->data) contains(top->left, data);
else if (data > top->data) contains(top->right, data);
}
}
功能对,实际上是在树中的值返回false。谁能帮忙?
感谢,
最大
编译器是大约警告有关这样的事情非常好。你打开了警告吗? –