WeBeginners-Community / DocBook

Documentations of Html to every open source technologies. It's a low-code repository
30 stars 54 forks source link

BFS AND DFS Graph Traversal Algorithms #134

Closed shailja2727 closed 1 year ago

shailja2727 commented 1 year ago

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

BFS(Breadth First Search) is a graph traversal algorithm which uses a queue. It starts at the tree’s root or graph and searches/visits all nodes at the current depth level before moving on to the nodes at the next depth level. Breadth-first search can be used to solve many problems in graph theory.

DFS(Depth First Search is a graph traversal algorithm which uses a stack . he algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking.

Describe the solution you'd like.

Using Stack for Depth First Search for backtracking. Using Queue for Breadth First Search for traversal(level Order)

Describe alternatives you've considered.

NA

Add any other context or screenshots about the feature request here.

Snapshot of Code: image

Output: image

shailja2727 commented 1 year ago

@Sulagna-Dutta-Roy Ma'am I've created a pull request with the assigned issue .Please Check