Update algorithms.cpp