I was asked at an interview, the efficient way to solve a problem checking for pallindrome.
Now i can do two things:
The second is recursive. My question is what is the difference in the space complexity of an algorithm's recursive and non-recursive versions?
Have a read at
Basically, a recursive algorithm will add overhead since you store recursive calls in the execution stack.
But if the recursive function is the last line of the call (tail recursion) then there is no additional penalty.
That is of course both algorithms are the same.