Temperature impact and programming algorithm for RRAM based memories