Does the following snippet of code exhibit Locality of reference? If so, explain which variable and/or statement exhibit
Posted: Sun Jul 10, 2022 11:31 am
Does the following snippet of code exhibit Locality ofreference? If so, explain which variable and/or statement exhibitswhat type of LOR and why?
Varvalue = 5; Sumvalue = 10;
for (int i = 0; i<= 10; i+=2)
if (i%2==0)
Varvalue = Varvalue +a
else
Sumvalue = Sumvalue +a;
Varvalue = 5; Sumvalue = 10;
for (int i = 0; i<= 10; i+=2)
if (i%2==0)
Varvalue = Varvalue +a
else
Sumvalue = Sumvalue +a;