Simple Preorder Traversal
```class Solution {\n    private void helper(Node root)\n    {\n        if(root == null)\n            return;\n        //since it is a leaf node it wont have an
```class Solution {\n    private void helper(Node root)\n    {\n        if(root == null)\n            return;\n        //since it is a leaf node it wont have any child \n        if(root.left == null && root.right == null)\n            return;\n        //stand on parent and connect left child to right child\n        root.left.next = root.right;\n        \n        //after connecting left child to right , connect parent\'s right child via the next link we created above to left child of adjacent subtree.\n        if(root.next != null)\n            root.right.next = root.next.left;\n        \n        helper(root.left);\n        helper(root.right);\n    }\n    public Node connect(Node root) {\n        helper(root);\n        return root;\n    }\n}
['Java']