Algorithm class implementation