Tested the algorithm