algorithm1 w/o benchmark test