Algorithm1 finished.