In java, the maximum stack size was about 5000 so recursion on trees would give stackoverflow(I am talking about internal stack size), so we had to use iterative dfs.But, I have seen many solutions where in C++, we can use recursion even if number of nodes is 10^5.Is it that the recursion depth in C++ is larger than that in Java, or is it that in those problem testcases skew trees where not present and that internal stack size of C++ is the same as Java.
As to specific problems, I have seen some solutions in Wealth disparity problems of INOI practice contest., along with some other examples, the problems of which I do not remember.
Please tell as INOI is closeby and it would really help if I am able to write a recursion based dfs, not because I cannot do the iterative one but because recursion is much simpler.