documentation: algorithm