Those two codes are not related. The knock sensor is known to go bad in the Altimas. You'll need to replace that but its a lots of work involved. I have a brand new one for a decent price, if you need one. Send me PM.
For the IACV code, first check the TPS voltage during idling. If its sitting around 0.3-0.7V then something is likely bad with the IACV system.
For the IACV code, first check the TPS voltage during idling. If its sitting around 0.3-0.7V then something is likely bad with the IACV system.