Which data structures are used for BFS and DFS of a graph?
Long Answer
Views 10774
Answer:
- 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).
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Data Structure, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.