data structures - element address in 3 dimensional array -
i looking formulas find memory location of element in 3-d array row major , column major. after using logic end following formulas. array a[l][m][n]
.
row-major:loc(a[i][j][k])=base+w(m*n(i-x)+n*(j-y)+(k-z))
column-major:loc(a[i][j][k])=base+w(m*n(i-x)+m*(k-z)+(j-y))
where x, y, z lower bounds of 1st(l) 2nd(m) , 3rd(n) index. tried formula , got correct result when applied formula on question in book answer did not match. please can me out this.
Comments
Post a Comment