【发布时间】:2014-09-05 05:36:42
【问题描述】:
这是我在 bst 中的高度函数。 cpp
int IntBinaryTree::getHeight(TreeNode * nodePtr)
{
if(nodePtr = NULL)
return 0;
else
return (max(1+getHeight(nodePtr->left), 1+getHeight(nodePtr->right)));
}
当我在 main() 中调用它时。我有一个错误。
这是我的 main()
int main {
IntBinaryTree tree;
....
tree. getHeight();
return 0;
}
【问题讨论】:
-
可能是您没有将参数传递给您的函数吗?
标签: c++ binary-tree binary-search