Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recursion/AdvancedQuestions.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ static void floodFill(int a[][], int r, int c, int toFill, int prevFill) {
}
a[r][c] = toFill;

//recursing for above of the a[r][c]
floodFill(a, r-1, c, toFill, prevFill);
//recursing for right of the a[r][c]
floodFill(a, r, c-1, toFill, prevFill);
//recursing for below of the a[r][c]
floodFill(a, r+1, c, toFill, prevFill);
//recursing for left of the a[r][c]
floodFill(a, r, c+1, toFill, prevFill);
}

Expand Down