Which data structures are used for BFS and DFS of a graph?
Which data structures are used for BFS and DFS of a graph?
Queue is used for BFS
Stack is used for DFS. DFS can also be implemented using recursion (Note that recursion also uses function call stack).