Investigation on the structures and magnetic properties of carbon or nitrogen doped cobalt ferrite nanoparticles