What is the difference between Greedy-Search and Uniform-Cost-Search?

前端 未结 3 716
盖世英雄少女心
盖世英雄少女心 2021-02-01 16:46

When searching in a tree, my understanding of uniform cost search is that for a given node A, having child nodes B,C,D with associated costs of (10, 5, 7), my algorithm will cho

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-01 17:25

    In a uniform cost search you always consider all unvisited nodes you have seen so far, not just those that are connected to the node you looked at. So in your example, after choosing C, you would find that visiting G has a total cost of 40 + 5 = 45 which is higher than the cost of starting again from the root and visiting D, which has cost 7. So you would visit D next.

提交回复
热议问题