At iteration i, there are n − i locations to choose from, and a naive computation of the argmax is O(n), resulting in an O(n 2 ) algorithm.
it is still a greedy, best-first algorithm leading to an efficient implementation.