void connect(TreeLinkNode *root) {
connect(root,NULL);
}
void connect(TreeLinkNode root, TreeLinkNode sub){
if(!root) return;
root->next=sub;
connect(root->left,root->right);
if(sub)
connect(root->right,sub->left);
else
connect(root->right,NULL);
};
Last updated 6 years ago