89 views

Consider the integer array $A\left [ 1.........100,1.......100 \right ]$ in which the elements are stored in $Z$ representation. An example of a $5\times 5$ array in $Z$ representation is shown below:

If the base address of $A$ is starting from $1000$ onwards, size of each element is $1B$ and $A$ is stored in Row Major Order, then the address corresponding to $A\left [ 100 \right ]\left [ 55 \right ]$ is ________________

edited | 89 views
+2

1252

There will be 252 elements before A[100][55] in Z representation, which will be stored in address locations [1000 - 1251] and finally A[100][55] goes to the base address of 1252.

0

@balchandar reddy san

how r u calculating?

I think question like this. In 1st and last rows , it took all elements. but other than these two rows, it took 1 element in each row diagonally. Am I right?

0
Yes..

so it will be 100 + 98 + 54 before A[100][55]
0
but why $+54??$

is it not $+56??$ because, it is counting from $0$ to $55??$
0
It's counting from 1, so it should be +54 for the element before and +55 for the given element
0
ok, but index is 55

So, ans should be 1253

right?
+1
Base address is 1000 so the address for the given element will be 1252
0
ok yes, thanks, I got it :)

1
2
3