search
Log In
0 votes
227 views
Caption

 

in Algorithm Challenges 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
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.

Related questions

0 votes
0 answers
1
0 votes
0 answers
2
539 views
This question is in CLRS,if we have a max heap it is always in sorted order(descending) order.And by extension if we have min heap the array is sorted in ascending order.Is this true? I have a counter example for 100,50,20,1,3,10,5,this satisfied max- ... it as an array is it an heapified representation or not? If we heapify after deletion and store max deleted element then we get sorted array.
asked Nov 15, 2018 in DS sripo 539 views
0 votes
1 answer
3
291 views
Given an sorted array in descending order, what will be the time complexity to delete the minimum element from this array?
asked Jun 12, 2018 in DS iarnav 291 views
0 votes
2 answers
4
223 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)$
asked Mar 20, 2018 in Algorithms Subham Nagar 223 views
...