Calculate address of an element in an array., Data Structure & Algorithms

Q. Explain the technique to calculate the address of an element in an array. A 25 × 4 matrix array DATA is stored in memory in 'row-major order'. If base address is 200 and ω = 4 words per memory of the cell.  Calculate the DATA address [12, 3]                                                                                     

Ans:

In a row major representation, address of any element a[i][j] can be found using the formula written below: a[i][j]=base(a)+(i*m+j)*size where base(a) is base address, m is the number of columns and size represent size of word.

DATA[12,3]=200+(12*4+3)*4

=200+(48+3)*4

=200+51*4

=200+204

=404 

 

 

 

 

Posted Date: 7/10/2012 5:21:13 AM | Location : United States







Related Discussions:- Calculate address of an element in an array., Assignment Help, Ask Question on Calculate address of an element in an array., Get Answer, Expert's Help, Calculate address of an element in an array. Discussions

Write discussion on Calculate address of an element in an array.
Your posts are moderated
Related Questions
Explain in brief about the Container An entity which holds finitely many other entities. Just as containers such as boxes, baskets, bags, pails, cans, drawers, and so for

Given a number that is represented in your data structure, you will need a function that prints it out in base 215 in such a way that its contents can be checked for correctness. Y

Example which cause problems for some hidden-surface algorithms Some special cases, which cause problems for some hidden-surface algorithms, are penetrating faces and cyclic ov

Q. The degree of a node is defined as the number of children it has. Shear show that in any binary tree, the total number of leaves is one more than the number of nodes of degree 2

I =PR/12 Numbers of years .Interest rate up to 1yrs . 5.50 up to 5yrs . 6.50 More than 5 yrs . 6.75 design an algorithm based on the above information

The first assignment in this course required you to acquire data to enable you to implement the PHYSAT algorithm (Alvain et al. 2005, Alvain et al. 2008) in this second assignment

two standards ways of traversing a graph in data structure

Write an algorithm in the form of a flowchart that: inputs top speeds (in km/hr.) of 5000 cars Outputs fastest speed and the slowest speed Outputs average (mean) s

write a c++ program to find out the area of a curve y=f(x) between x=a and x=b

Which of the sorting algorithm is stable   Heap sorting is stable.