Skip to content

DFS Recursive code for 2D matrix in C++#54

Open
KrutikaBhatt wants to merge 4 commits into
khagapati-bagh:mainfrom
KrutikaBhatt:dfs_recursive
Open

DFS Recursive code for 2D matrix in C++#54
KrutikaBhatt wants to merge 4 commits into
khagapati-bagh:mainfrom
KrutikaBhatt:dfs_recursive

Conversation

@KrutikaBhatt

Copy link
Copy Markdown
Contributor

I have added the DFS Recursive code for 2D matrix in C++.

@khagapati-bagh khagapati-bagh left a comment

Copy link
Copy Markdown
Owner

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]){

Copy link
Copy Markdown
Owner

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);

Copy link
Copy Markdown
Owner

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

@KrutikaBhatt

Copy link
Copy Markdown
Contributor Author

I have made the necessary changes and added the Time and Space complexities along with the modifications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants