ajay-dhangar / algo

This repository contains a collection of data structures and algorithms implemented in various programming languages. It is designed to help learners understand key concepts through hands-on examples. Contributions and improvements are welcome!
https://ajay-dhangar.github.io/algo/
MIT License
41 stars 127 forks source link

[Feature Request] <Breadth First Search (BFS) Algo> #513

Open Gopal0Gupta opened 3 days ago

Gopal0Gupta commented 3 days ago

🚀 Feature Request

Is your feature request related to a problem? Please describe.

The repository lacks an implementation of Breadth First Search (BFS), which is essential for many graph-related problems like finding the shortest path in an unweighted graph, level-order traversal in trees, and solving puzzles like the shortest path in a maze. The absence of BFS may limit the ability of users to explore these graph-based algorithms effectively.

Describe the solution you'd like

I propose to add the Breadth First Search (BFS) algorithm in Java to the repository.

Describe alternatives you've considered

Other alternatives, such as Depth First Search (DFS), are useful but perform differently from BFS in scenarios like shortest pathfinding in unweighted graphs. DFS explores one branch completely before backtracking, while BFS explores all neighbors at the current depth level before moving deeper, making it more suitable for breadth-wise search applications.

Additional context

The implementation will include test cases to verify BFS on both directed and undirected graphs. Example problems, such as level-order traversal in a tree and shortest path finding in a maze, will be included to demonstrate the practical application of BFS.


Would you like to work on this feature?

Gopal0Gupta commented 3 days ago

@ajay-dhangar please assign me this issue under hacktoberfest and gssoc extd.