This algorithm combines the characteristics of the uniform-cost search and pure heuristic search to compute optimal solutions effectively. As A* algorithm searching the path inside the graph, it refers to a path with the lowest known cost and keeping a sorted priority queue of alternate path segments along the way. If a segment of the path being traversed has a higher cost than other encounter path segments at any point, it will ignore the higher-cost path and travelled to the lower-cost path instead. The process will be repeated until the path reaches its goal.