Question: Q1 13 marks The three functions in Figure 1 (written in C) perform the same operation with varying degree of spatial locality. Rank-order the functions

Q1 13 marks The three functions in Figure 1 (written in C) perform the same operation with varying degree of spatial locality. Rank-order the functions with respect to the spatial locality enjoyed by each. Justify your ranking (a) An array of structs (b) The clear1 function #define N 1000 1void clear1 (point *p, int n) 3 typedef struct int i, j int vel [3]; int acc[3]; for (i0; i point; 8 point p[N]; 10 (c) The clear2 function (d) The clear3 function 1void clear2 (point *p, int n) 1void clear3(point *p, int n) int i, j; int i, j for (i- 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
