Home / Questions / Which data structures are used for BFS and DFS of a graph?
Explanatory Question

Which data structures are used for BFS and DFS of a graph?

👁 10,778 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

  • 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).