A* search uses the best-first algorithm below where the priority queue is
ordered by h(s) + d(s) (heuristic plus depth).
Search(s)
d[s] = 0
pred[s] = null
PQ = {s}
while PQ ≠ {} do
u = Remove[PQ]
if success
then return u
else
for each v ∈ Expand(u) do
Add(PQ,v)
return null