I do not have access to the JVM settings since I am submitting code to be run elsewhere, so I can't follow the other Stack Overflow answers about extending stack size. Is there any way to do it from inside my Java file?
The reason I want to do this (not really important):
I am using recursion on a tree with 10^5 nodes. The average case is ok, but there is no guarantee on the shape of the tree. I am dealing with an edge case where the tree is just one long line. I get a StackOverflowError, but my algorithm would run fine if I could just extend my stack size. I've though about dealing with this case by finding the centroid of the tree or using sparse matrixes, but I would much rather just double my stack size and use my existing code.