minor modification. update the interface of algorithm.h