What is the difference between formulas E=p^2/2m and E= hf ?
You cannot understand a formula without its context. The first E in reality means: Energy of a non-relativistic, non-interacting, classical particle. The second E refers to the energy of a non-interacting, quantum photon.
p^2/2m is non-relativistic kinetic energy
E=hf usually means total energy of a photon
Separate names with a comma.