标签:
这题代码简单,不过不容易想到。
void connect(TreeLinkNode *root) { if (root == nullptr ||root->left==nullptr)return; root->left->next = root->right; //关键 if (root->next != nullptr) root->right->next = root->next->left; connect(root->left); connect(root->right); }
Populating Next Right Pointers in Each Node
标签:
原文地址:http://www.cnblogs.com/573177885qq/p/5656070.html