Related Articles
ISRO | ISRO CS 2011 | Question 3
• Last Updated : 14 May, 2018

In compiler terminology reduction in strength means
(A) Replacing run time computation by compile time computation
(B) Removing loop invariant computation
(C) Removing common subexpressions
(D) replacing a costly operation by a relatively cheaper one

Explanation: Strength Reduction is a compiler optimization in which costly operations are replaced by cheaper ones. Example: Exponentiation is replaced by multiplication and multiplication is in return replaced by addition.
The following code is having multiplication operator:

```a = 10;
for (i = 0; i < X; i++)
{
Z[i] = a * i;
}```

This code can be replaced by the following code by replacing the multiplication with addition.

```a = 10;
k = 0;
for (i = 0; i < X; i++)
{
Z[i] = k;
k = k + a;
}```

So, option (D) is correct.

Quiz of this Question

Attention reader! Don't stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up