Question: The three functions in Figure 6.20 perform the same operation with varying degrees of spatial locality. Rank-order the functions with respect to the spatial locality

The three functions in Figure 6.20 perform the same operation with varying degrees of spatial locality. Rank-order the functions with respect to the spatial locality enjoyed by each. Explain how you arrived at your ranking.

Figure 6.20

(a) An array of structs 1 #define N 1000 234 5 6 7 8 1 2 3 4 5 6 7 (c) The clear2 function 8 typedef struct {

(a) An array of structs 1 #define N 1000 234 5 6 7 8 1 2 3 4 5 6 7 (c) The clear2 function 8 typedef struct { int vel [3]; int acc [3]; 9 10 11 } point; point p[N]; void clear2(point *p, int n) { } int i, j; for (i 0; i

Step by Step Solution

3.40 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The key to solving this problem is to visualize how the array is ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!