Computes the algorithm