You can view the search algorithm to have a queue of other nodes to search. This answer demonstrates this principle .
When searching by depth, you add the current children of the node to the front of the queue (stack). On the first search, you add the current user node to the back of the queue. Think for a moment about how this leads to the correct behavior for these algorithms.
Now, when searching on a hill, you sort [1] the current children of the node before adding them to the queue. In the first search, you add the current children of the node to the queue in any old order, and then sort the entire queue [1]. If you are thinking about the effect that the search order of nodes may have, you should get an idea of ββthe practical difference.
I understood this concept is too subtle to understand its purely abstract terms, but if you work with a few examples with a pencil, it becomes simple.
[1]: sort according to some specific task-specific evaluation of the node solution, for example, "distance from destination" in the search for paths.
Brendan
source share