in DS
859 views
0 votes
0 votes
Find the address of the position [10, 11, 12] of array A in column major order? Given  
Dimension is A[1:10, -5:15, -10:15], w is two word count, and Base address is 200.
in DS
by
859 views

1 comment

200 + 10*2 + 16*2 + 22*2 ?
0
0

1 Answer

0 votes
0 votes
base=200
size=2
given array=[10][15][15]
                         l      m   n
             
find=[10][11][12]
            k     i     j
first element=[1][-5] [-10]
                        k0   i0     j0

formula for column major order

A[k][i][j]= (((k-k0)*m*n)+((j-1)*m)+(i-1))*size+base

=(10-1)*15*15+(12-(-10)*15)+(11-(-5))*2+200
=(2025+330+16)*2+200
=5142