Why is the complexity of A* exponential in memory?

前端 未结 3 1450
无人共我
无人共我 2021-02-02 12:43

Wikipedia says on A* complexity the following (link here):

More problematic than its time complexity is A*’s memory usage. In the worst case, it must

3条回答
  •  野的像风
    2021-02-02 13:20

    I think the exponential-ness comes into play when you backtrack to node B to expand it, but then backtrack to node C to expand it, and then backtrack to node D. Now we have to keep track of all the children of nodes A, B, C, and D.

    The backtracking is based on the cost of the edges to move to the next node, so this is a real possibility, but is the worse case.

    If each node has exactly 2 children off of it, and each node has the same cost, then the equation is 2^n, where n is the depth of the search so far.

    For example, you start off with node 0. 0 has 2 children 00 and 01. 00 has 2 children 000 and 001. At the worse case with a depth of 4 the equation is 2^4, where 2 is the number of children each node has and 4 is the depth of the search.

提交回复
热议问题