i need some help on this...
i need to find the height of a BST with the function prototype
int height();
i know how to do it if the prototype is
int height (BSTNode *treePtr) const
{
if (treePtr == NULL)
return 0;
else
{
if (findheight (treePtr ->right) > findheight(treePtr ->left))
return 1 + findheight (treePtr ->right);
else
return 1 + findheight(treePtr ->left);
}
}
but with just int height()
i can't pass anything in there...
does anyone have any idea???
thanx
i need to find the height of a BST with the function prototype
int height();
i know how to do it if the prototype is
int height (BSTNode *treePtr) const
{
if (treePtr == NULL)
return 0;
else
{
if (findheight (treePtr ->right) > findheight(treePtr ->left))
return 1 + findheight (treePtr ->right);
else
return 1 + findheight(treePtr ->left);
}
}
but with just int height()
i can't pass anything in there...
does anyone have any idea???
thanx