Consider the following C code segment.
for (i = 0, i < n; i++)
for (j = 0; j < n; j++)
x += (4*j + 5*i);
y += (7 + 4*j);
Which one of the following is false?
is used at two places- so common subexpression elimination is possible
is loop invariant for the inner loop
5*i is also loop invariant for inner loop
x += 5*i
can be replaced by
x += p;
p +=5; (p must be initialized to 0 before the loop).
Thus replacing * with + gives strength reduction.
So, only (D) is false here.
18th jan was the last date