The Gateway to Computer Science Excellence
0 votes
108 views
Caption

 

in Algorithm Challenges by (143 points) | 108 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
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[10][2]  since a[1][2]=2 a[2][2]=11  similarly  (like A.P.) a[10][2] =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.

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,645 questions
56,601 answers
195,852 comments
102,212 users