```
1
/ \
2 3
/ \ / \
4 5 6 7
/ \ / \ / \
7 8 9 10 11 12
```

I believe my code which has passed all test will not connect the 8 and 9, although the tree satisfy the condition that "You may assume that it is a perfect binary tree (ie, all leaves are at the same level, and every parent has two children)." Let me know if I misunderstand this.

```
void connect(TreeLinkNode *root) {
if(root==NULL) return;
if(root->left)
root->left->next = root->right;
if(root->right)
root->right->next = (root->next) ? root->next->left:NULL;
connect(root->left);
connect(root->right);
}
```