Populating Next Right Pointers in Each Node

Populating Next Right Pointers in Each Node

这题代码简单,不过不容易想到。

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); }
上一篇:NSException


下一篇:Android 蓝牙4.0 BLE (onServicesDiscovered 返回 status 是 129,133时)