I am reading a lecture in https://www.ics.uci.edu/~welling/teaching/271fall09/UninformedSearch271f09.pdf
The memory usage in BFS is O(b^d+1), and the memory usage in ID-DFS is O(bd).
There's one thing that I want to check, why ID-DFS does not store all the visited nodes?
The reason I have figure out is that it only needs to store the path and the nodes that it has expanded on the path. For other nodes outside the path that it has visited can be discarded from the tree(free them from memory), because these nodes are not benefit to directing from root to the goal node.
For BFS, because we don't know where the solution is, we can not discard the nodes that we have visited until we have found the solution.
Is above thought correct or wrong?
Notes: To be more precise, in ID-DFS, to the best of my knowledge, when visiting a node, we should generate all legal children of it, say n children, and visit the first child n1. For the second child n2, it will be visited until the limited-depth DFS has done searching n1. That's why the memory usage in ID-DFS is O(bd), branching factor times depth. For some application that it don't need to generate all children when visiting a node, it can just generate the first child; for the second child, it can be generated after searching the n1 and return. For such modification, it only need to store the path, so its memory usage is O(d).

