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
N = number of rows of the graph D[i[j] = C[i][j] For k from 1 to n Do for i = 1 to n Do for j = 1 to n D[i[j]= minimum( d ij (k-1) ,d ik (k-1) +d kj (k-1)

Ask consider the file name cars.text each line in the file contains information about a car ( year,company,manufacture,model name,type) 1-read the file 2-add each car which is repr

By changing the NULL lines in a binary tree to the special links called threads, it is possible to execute traversal, insertion and deletion without using either a stack or recursi

Description A heap is an efficient tree-based data structure that can be used as a priority queue. Recall that the abstract data type of a priority queue has the following opera

Which sorting methods would be most suitable for sorting a list which is almost sorted  Bubble Sorting method.


Define data model?  A data model is a collection of conceptual tools for explaning data, data relationships, data semantics and consistency constraints.

Explain in detail about the Ruby arrays Ruby arrays have many interesting and powerful methods. Besides indexing operations which go well beyond those discussed above, arrays h

You need to write a function that performs multiplication of two numbers in your data structure. Again, remember how you multiply numbers in base 10 and you should be fine. Multipl

whate is meant by the term heuristic