-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DFS Recursive code for 2D matrix in C++ #54
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @KrutikaBhatt, Thank you for your contribution.
Please check my comments and update accordingly.
int length = 4; | ||
int height = 4; | ||
|
||
if (row < 0 || col < 0 || row >= length || col >= height || visited[row][col]){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add 1 space between ) and {
}; | ||
|
||
cout <<"The Depth first traversal to the matrix is : "; | ||
DFS(grid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a return 0
statement. Because this is not a void method
I have made the necessary changes and added the Time and Space complexities along with the modifications |
I have added the DFS Recursive code for 2D matrix in C++.