public static List<Integer> traverseWithRecursive(TreeNode root) {
        List<Integer> result = new ArrayList<Integer>();
        if (root == null)
            return result;

        result.add(root.val);
        result.addAll(traverseWithRecursive(root.left));
        result.addAll(traverseWithRecursive(root.right));
        return result;
    }