add some generic algorithm