Clebsch-Gordan coefficients and Racah coefficients for the SU(2) and SU(1,1) groups as the discrete analogues of the Poschl-Teller potential wavefunctions