A* algorithm for our CS tutorial