algorithm prototype