在我的程序中,我在给定目标的同时递归地尝试在树中找到一个节点,但我无法让它工作!
Stree::Node * Stree::find_node(Node* cur, string target)
{
Node *tmp = cur;;
if(cur == NULL || tmp == NULL)
return NULL;
if(cur->m_city == target || tmp->m_city == target)
return cur;
if(find_node(tmp->m_left, target))
{
return tmp;
}
else return find_node(cur->m_right, target);