Skip to content
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

Create BFS_DFS.c #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 21, 2023

  1. Create BFS_DFS.c

    Breadth-First Search (BFS) and Depth-First Search (DFS) are fundamental graph traversal algorithms:
    
    Breadth-First Search (BFS): BFS explores a graph by systematically visiting all the nodes at the current level before moving to the next level. It starts from a designated source node and explores its neighbors first, then moves to their neighbors, and so on. This breadth-first exploration is like ripples in a pond, ensuring that you visit nodes in order of their distance from the source. BFS is useful for finding the shortest path in an unweighted graph and for exploring all nodes within a specific radius from the source.(using queue)
    
    Depth-First Search (DFS): DFS, on the other hand, explores as deeply as possible along one branch before backtracking. It starts at the source node, explores one branch completely, then goes back and explores another branch. This depth-first exploration is like exploring a maze by going as far as you can in one direction before turning back. DFS is useful for tasks like topological sorting, cycle detection, and pathfinding but doesn't guarantee the shortest path.(using stack)
    AtharvaKulkarniIT authored Nov 21, 2023
    Configuration menu
    Copy the full SHA
    127ef36 View commit details
    Browse the repository at this point in the history