the a algorithm