# Question on Array

227 views

0
i am getting

1) 83 ===>option D

2) 181 ===> option D

is these are right?
0
Yes,I am also getting the same answers.
0

How?

0
what is the size of the word ?
1

ANS(1)  array is given as a=$\begin{bmatrix} 1& 2 & 3 & 4 &5 & 6 & 7 &8 &9 \\ 10& 11& 12 & ..& ..& &.. & &18 \\ 19 &20 &21 & .. &. & ..& &. . &27 \\ .. &.. & & .. & & ...&... &.. & ..\\ & & & & & & & & \\ & & & & & & & & \\ & & & & & & & & \\ & & & & & & & & \\ ..& ... ..&. .. ..& &.. & .. .& ..& .. & \\ 82 & 83 & 84 &85 &86 &87 &88 &89 &90 \end{bmatrix}$

now the address 67 first find 67-29=38

word size =2

now assume you have to find out address of element 10  , it will be 29 +2=31 as array is stored in column major order

similarly , for address 67 we can find number of elements between these addresses i.e.  67-29=38

#elements=38/2=19 it will be a  since a=2 a=11  similarly  (like A.P.) a =2+(10-1)9=83

ANS(2) I think option A is correct

using column major order 29+[(7-1)*10+6]*2=161

0

@hitendra singh

I think you put the wrong formula for the column-major order.

ans will be 181.

## Related questions

1
148 views
An array $'A'$ has $n$ distinct integers. What is the tightest time complexity to check $A[i]=i$ for some $i$. Consider all elements of array within range from $1$ to $n$. $O(n^2)$ $O(1)$ $O(n)$ $O(logn)$