Tree: Preorder Traversal

  • + 0 comments

    JAVA:

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