Algorithm base class and an example.