for algorithm