```
class Solution
{
public:
void connect( TreeLinkNode * root )
{
TreeLinkNode * nextLevel = root;
if( root )
{
for( ; root->left; )
{
if( root->left )
{
root->left->next = root->right;
}
if( root->next )
{
root->right->next = root->next->left;
root = root->next;
}
else
{
root = nextLevel = nextLevel->left;
}
}
}
}
};
```