linear algo first complete not tested