My recursive solution(Java)
\n    public void connect(TreeLinkNode root) {\n        if(root == null)\n            return;\n            \n        if(root.left != null){\n            root.le
\n    public void connect(TreeLinkNode root) {\n        if(root == null)\n            return;\n            \n        if(root.left != null){\n            root.left.next = root.right;\n            if(root.next != null)\n                root.right.next = root.next.left;\n        }\n        \n        connect(root.left);\n        connect(root.right);\n    }
[]