Question: why dfs is not optimal?
Answer: DFS is non-optimal in nature. ... In DFS, we need to store only the nodes which are present in the path from the root to the current node and their unexplored successors. For state space with branching factor b and maximum depth m, DFS has space complexity of O(bm), a much better improvement over that of BFS.