On second order linear differential equations with algebraic solutions