Which data structures are used in BFS and DFS algorithm?
In BFS algorithm, Queue data structure is used. In DFS algorithm, Stack data structure is used. Both BFS (Breadth-First Search) and DFS (Depth-First Search) algorithms can be implemented using various data structures. Here are the commonly used ones: Queue for BFS: BFS typically uses a queue data structure to keep track of the nodes to … Read more