Many kinds of problems can be solved by search, which involves finding a goal from a starting state by applying operators that lead to a new state.
Suppose that a robot can take 4 actions: move west, north, east, or south. We could represent the state of the robot as its position. From any given state, the robot has 4 possible actions, each of which leads to a new state. This can be represented as a root node (initial state) with 4 branches to new states.
Depth-first search ( DFS) follows an implicit tree of size O(bdepth), where b is the branching factor. Given a state, we test whether it is a goal or a terminal failure node; if not, we generate successor states and try searching from each of them. Most of these searches will fail, and we will backtrack and try a different branch.
The program execution stack records the state of examining each node. We may need our own stack of previous states to avoid getting into a loop, wandering in circles. We will return a stack of operators so we can record how we reached the goal. All of these stacks are O(depth).
Contents    Page-10    Prev    Next    Page+10    Index