General purpose algorithm and class library