in Compiler Design
144 views
0 votes
0 votes

Here i am getting ans as 1872 but ans given is 2208

in Compiler Design
144 views

1 Answer

2 votes
2 votes
Best answer

For array $A[p1...p2][r1….r2][c1….c2]$, where each element takes n memory locations, 

In R.M.O:-

Address of element $A[i][j][k]$ =

Base Address + $ \ [(i-p1)*(r2-r1+1)*(c2-c1+1) + (j-r1)*(c2-c1+1)+(k-c1)]*n$

Here, address of element $A[4][3][9] $ = $1000 + [(4-1)*(5-0+1)*(11-5+1) + (3-0)*(11-5+1)+(9-5)]*8$

= $1000 + [3*6*7 + 3*7 + 4]*8$

= $1000 + [126 + 21 + 4] * 8$

= $1000 + 151*8$

= $1000 + 1208$

$2208$ (Answer)

 

selected by