TheAlgorithms / C-Plus-Plus

Collection of various algorithms in mathematics, machine learning, computer science and physics implemented in C++ for educational purposes.
https://thealgorithms.github.io/C-Plus-Plus
MIT License
29.7k stars 7.05k forks source link

Breadth First Search in a Matrix showing Path Construction #2654

Closed Srikrishnan2004 closed 7 months ago

Srikrishnan2004 commented 9 months ago

The goal of this program is to demonstrate an optimized approach for performing breadth-first search (BFS) in a matrix when given source and destination coordinates. Unlike the typical BFS implementation that requires a separate visited array or visited matrix, this approach eliminates the need for such data structures when working with a matrix.

Furthermore, this program not only efficiently computes the shortest path from the source to the destination but also constructs and visualizes the path.

The following images shows the input and output for the code which I have proposed.
Screenshot 2023-10-28 231039

Screenshot 2023-10-28 231134

Screenshot 2023-10-28 231235

By merging this pull request, the repository can benefit from an improved BFS algorithm that simplifies the codebase by eliminating the need for a visited array or visited matrix.

github-actions[bot] commented 8 months ago

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 7 months ago

Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!