You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backtracking > Floodfill
Hi,
When same int color is passed as both newColor and oldColor parameter, code goes to infinite calling loop in recursion and stack overflow exception occurs causing program to shut down.
My observation is , this case is not handled properly in base cases and
I would really like contributing to resolve this issue.
Here is my PR , resolving this issue : #4359
Thanks.
Steps to reproduce
Pass same color as newColor and oldColor as example while calling FloodFill.floodFill method.
java.lang.StackOverflowError
at com.thealgorithms.backtracking.FloodFill.floodFill(FloodFill.java:49)
at com.thealgorithms.backtracking.FloodFill.floodFill(FloodFill.java:49)
at com.thealgorithms.backtracking.FloodFill.floodFill(FloodFill.java:50)
at com.thealgorithms.backtracking.FloodFill.floodFill(FloodFill.java:49)
at com.thealgorithms.backtracking.FloodFill.floodFill(FloodFill.java:50)
...
Excepted behavior
As both new and old color are same it should not change anything in given image and return from the function without any exception or issue.
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Description
Backtracking > Floodfill
Hi,
When same int color is passed as both newColor and oldColor parameter, code goes to infinite calling loop in recursion and stack overflow exception occurs causing program to shut down.
My observation is , this case is not handled properly in base cases and
I would really like contributing to resolve this issue.
Here is my PR , resolving this issue : #4359
Thanks.
Steps to reproduce
Pass same color as newColor and oldColor as example while calling FloodFill.floodFill method.
This testcase produce error as below :
Excepted behavior
As both new and old color are same it should not change anything in given image and return from the function without any exception or issue.
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: