i got a programm with realy deep recursions, iam sure it has no endless loop. But after short time (1s) i get
java.lang.StackOverflowError
is there a possibility to increase the time that he trys to end the programm? I would like to run it a few hours if possible 😉
To further the comments about reducing recursion/changing to an iterative pattern, and example may be useful. If we take the factorial function as an example, it can be written recursively (and often is) like this:
however, it could be done iteratively (and therefore avoid producing stack overflows for large n) like this
It is probably worth doing something similar to your code to avoid the recursion (which is likely the cause of your Error) as it is (almost?) always possible to make recursion iterative