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.
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:
Output: