Optimal Algorithms for Finite Dimensional Simply Generated Algebras