Question: (Loop unrolling) 1) Are the following two pieces of code functionally equivalent? Assume the length of array a is always bigger than count. (30 points)
(Loop unrolling) 1) Are the following two pieces of code functionally equivalent? Assume the length of array a is always bigger than count. (30 points)
a) int count; int a[]; // int i =0 ; while (i b) int count; int a[]; // i=0; while (i if (i<=count-1) { a[count-1] = count -1; } if (i==count-2) { a[count-2] = count -2; } 2) Measure and compare the average performances of the above pieces of code by running each piece many times (e.g. count =1,000,000). Describe your method and results. Also attach your code (70 points).
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
