Polynomial Factorization and Curve Decomposition Algorithms