- starts at the top most node
- down to the next level moving across the level from left to right
- and then moving to the next level (repeat) until you find the goal
Depth First Searching
- starts at the top most parent node
- dives down taking the left most path at each node until it can go any "deeper" before backtracking
Comparison
- BFS guarentees a solution
- BFS guarentees the best solution
- BFS requires more memory - must remember what each node is at every level
- DFS requires less memory - only must remember previous node
- DFS - may be lucky and find a solution
- DFS - may follow a branch with no solution
- DFS may get stuck in an infinite loop - so require backtracking and also tracking of the states
No comments:
Post a Comment