我对如何初始化 m_parent 以指向子节点上方的节点感到困惑。
class Node
{
public:
Node(string city);
~Node();
string m_city;
int m_parent_distance;
Node *m_left;
Node *m_right;
Node *m_parent;
};
Node *m_root;
//void test_print(string target, Node *cur_root);
Node * find_node(Node *m_root, string target);
这是节点构造函数
Stree::Node::Node(string city)
{
m_city = city;
m_left = NULL;
m_right = NULL;
//what do i do with m_parent??
m_parent_distance = 0;
}