add the algorithm I have written