Binary Search Tree Problems

  • Thread starter pleatofthepants
  • Start date
P

pleatofthepants

I have a maxValue function that is called when I am removing a node
from my tree.

template <class T>
T BST<T> :: maxValue (TreeNode<T>* p)
{
if (p == NULL) throw ("BAD POINTER");

while (p-> right)
{
p = p-> right;
return *this;
}
}

I am getting this error when it compiles: cannot convert BST<int> to
'int' in return
How do I fix this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top