algo4 runs, but is wrong