Completed algorithm basics for univariante polynomials not working correctly