Intermediate
Compilers & Programming Language Theory
Q51 / 100
What is strength reduction?
Correct! Well done.
Incorrect.
The correct answer is B) Replacing expensive operations with cheaper equivalents: x*2 → x+x, x*4 → x<<2, or converting multiplications in loops to additions
B
Correct Answer
Replacing expensive operations with cheaper equivalents: x*2 → x+x, x*4 → x<<2, or converting multiplications in loops to additions
Explanation
Strength reduction: mul by power of 2 → shift. In loops: for(i=0;i<n;i++) sum += a[i*stride] → track running offset. Induction variable strength reduction converts multiplications to additions.
Progress
51/100