Time Complexity:
Clearly, for $f(i) $,
$T(i) = O(i)$
Now, we have to see how many times $f(i)$ is called for $1 <= i <= n$ and then add the corresponding execution times of each of the $f(i)$'s:
$f(1) , f(2) , f(4) , f(8) ,.... , f(2^{k})$
such that $2^{k} <= n < 2^{k + 1}$
Adding the corresponding times of execution:
$T(1) + T(2) + T(4) + T(8) + ..... + T(2^{k})$
$= O(1 + 2 + 4 + 8 + ..... + 2^{k})$
$= O(2^{k + 1} - 1)$
$= O(2^{k + 1})$
$= O(2.2^{k})$
$= O(2n)$
$= O(n)$
Space Complexity:
For $f(i)$, the main requirement is to allocate space to $A[i]$ which is $O(i)$.
But once the function $f(i)$ has completed its execution, the space allocated to it is freed.
That means, next when we call $f(i + 1)$, $f(i)$ would not be occupying any space.
So, the maximum space required will be by the last function call: $f(2^{k})$ such that $2^{k} <= n < 2^{k + 1}$
So,
$Space(n) = O(2^{k}) = O(n)$