I am studying depth first search and he recursive version is really simple to implement. With a slightly more complicated implementation, one can use a stack to implement a non-recursive version.
What are the pros and cons of the recursive vs the non-recursive version? In my simple test cases, I could not see any statistically significant timing differences.
One issue that I can think of is that the recursive case could end up with a stack overflow error. So is there any reason to use the recursive implementation at all?