Tree: Preorder Traversal

  • + 0 comments

    function preOrder(root) {

     if(root){
        process.stdout.write(`${root.data} `);
        preOrder(root.left)
        preOrder(root.right) 
    }