add more function in algo.c