A / | \ B E F / \ /|\ C D G H Iwill be searched in alphabetical order, if a depth-first search is performed on it (searching leftmost branches first).

In agenda-based searching, that corresponds to the following steps:

- Add the first node to the agenda (in this case, A).
- Examine the first node on the agenda to see if it is the required item.
- Otherwise, expand the node (find all its children), and add those children to the
*beginning*of the agenda. - Repeat the second and third steps until the goal is reached.

The advantages to depth-first search (over breadth-first search) is that it takes less memory, and therefore is less likely to fail. The disadvantages are that it takes longer, and will not always find the shortest path. Also, if the tree has loops in it (and is thus actually a graph, not a tree), then depth-first search can get stuck in a loop. DFS can also only deal with finite trees.