Recover the path to a goal state in A* search algorithm In the A* search algorithm, we use a priority queue with heuristic function to find optimum result with minimum cost. But, how do we get the path after reaching goal?
Every node should have been given a pointer to the node it was reached from. Then you only need to follow and reverse a linked list.