BFS
BFS, or Breadth-First Search, is an algorithm used for traversing or searching tree or graph data structures. It starts at a selected node, known as the root, and explores all its neighboring nodes at the present depth before moving on to nodes at the next depth level. This method ensures that the shortest path is found in unweighted graphs.
The algorithm uses a queue to keep track of nodes that need to be explored. As each node is visited, it is marked to prevent revisiting. BFS is commonly used in various applications, including finding the shortest path in maps and solving puzzles.