an implementation for algorithms