A* algorithm is the popular form of the Best first search. It tries to find the shortest path using the heuristic function with the cost function to reach the end node. The steps for A* algorithms are given below:
Step 1: Put the first node in the OPEN list.
Step 2: Check if the OPEN list is empty or not; if the list is empty, then return failure and stops.
Step 3: Select the node from the OPEN list which has the smallest value of evaluation function (g+h), if node n is goal node then return success and stop, otherwise
Step 4: Expand node n and generate all of its successors, and put n into the closed list. For each successor n’, check whether n’ is already in the OPEN or CLOSED list; if not, then compute evaluation function for n’ and place into Open list.
Step 5: Else if node n’ is already in OPEN and CLOSED list, then it should be attached to the back pointer, which reflects the lowest g(n’) value.
Step 6: Return to Step 2.