Tree: Inorder Traversal

  • + 0 comments

    My Java solution with linear time complexity and o(h) space complexity:

    public static void inOrder(Node root) {
            if(root == null) return;
            
            inOrder(root.left);
            System.out.print(root.data + " ");
            inOrder(root.right);
        }