A* orders frontier states by f = g + h: path cost so far plus an estimate to the goal. It updates a neighbor’s cost and parent when it finds a shorter route.
An admissible heuristic that never overestimates remaining cost can preserve optimality. A weak heuristic explores more states; an overestimate can sacrifice the best path.
When to use
Use it for pathfinding on maps or grids when a useful goal-directed estimate is available.