[Java] Flood fill using a stack
- by dafero
Hello to everyone :),
I am using the recursive Flood fill algorithm in Java to fill some areas of a image.
With very small images it works fine, but when de image becomes larger the JVM gives me a Stack Over Flow Error.
That's the reason why I have to reimplement the method using a Flood Fill with my own stack. (I read that's the best way to do it in these kind of cases)
Can anyone explain me how to code it? (if you don't have the code at hand, with the pseudo-code of the algorithm will be fine)
I've read a lot in the Internet but I haven't understood it very well.
Thanks!