A* is a best-first search, meaning that it solves problems by searching amoung all possible paths to the solution(goal) for the one that incurs the smallest cost(least distance, shortest time, etc.), and among these paths it first considers the one t…