```
class Solution {
public:
void connect(TreeLinkNode *root) {
if(!root||!root->left) return;
TreeLinkNode *current_left=root;//current layer's leftest node
TreeLinkNode *current=current_left;
while(current->left){
current->left->next=current->right;
current->right->next=current->next?current->next->left:NULL;
current=current->next;
if(!current){
current_left=current_left->left;
current=current_left;
}
}
}
};
```