470,870 Members | 1,048 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,870 developers. It's quick & easy.

Help with BST trees that have been templatized

help with my search tree can anyone help me??
i am stuck

template <typename NodeType>
NodeType* CBSTree<NodeType>::Insert(NodeType *newItem,
NodeType *nodePtr)

// Base case
if(true == IsTreeEmpty())
nodePtr = new NodeType(newItem->m_value);
m_root = nodePtr;
}else if(nodePtr == NULL)

// when I Get here it doesn't assign the address over to the other pointer??
// but i tried individually to put into the tree
// just assigning:
// nodePtr->m_right = new NodeType(newItem->value);
// if i do that it works
// would you please help i can't figure out what i am doing wrong??

nodePtr = new NodeType(newItem->m_value);
else if(newItem->m_value < nodePtr->m_value)
// Search left
else if(newItem->m_value > nodePtr->m_value)
// Search right

Dec 7 '07 #1
0 777

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by ma740988 | last post: by
3 posts views Thread by ptrSriram | last post: by
23 posts views Thread by mark.moore | last post: by
1 post views Thread by tavianator | last post: by
4 posts views Thread by David | last post: by
2 posts views Thread by mrstephengross | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.