c++ - pre order of binary search tree, errors, not sure what error is -
this function within of binary tree class
/*********************** * * give preorder of tree * * ********************/ void preorder(node * node, std::ostream &p_str){ if(node != null){ //p_str << node->data() << " "; if(node->m_ll) { preorder(node->m_ll, &p_str); } if(node->m_rl) { preorder(node->m_rl, &p_str); } } }
which makes phone call here outside of class. recursively traverse tree, starting root
void preorder(node * node, std::ostream &p_str){ if(node != null){ //p_str << node->data() << " "; if(node->m_ll) { preorder(node->m_ll, &p_str); } if(node->m_rl) { preorder(node->m_rl, &p_str); } } }
i'm getting errors like
tree.h:337: error: no matching function phone call 'ctree<int>::preorder(ctree<int>::node*&, std::ostream*)' tree.h:330: note: candidates are: void ctree<t>::preorder(ctree<t>::node*, std::ostream&) [with t = int] tree.h:343: error: no matching function phone call 'ctree<int>::preorder(ctree<int>::node*&, std::ostream*)' tree.h:330: note: candidates are: void ctree<t>::preorder(ctree<t>::node*, std::ostream&) [with t = int]
any thought of simple thing i'm overlooking?
preorder(node->m_ll, &p_str);
should preorder(node->m_ll, p_str);
c++ binary-search-tree
No comments:
Post a Comment