Tree: Preorder Traversal

  • + 0 comments
     public static void preOrder(Node root) {
            if(root != null){
                System.out.print(root.data+" ");
                preOrder(root.left);
                preOrder(root.right);
            }
        }