ICSE class IX computer practice Test

Array address Calculation

Binary Search

Single dimensional array
Address=B+W (I-L)
B=base address
W=size of the element
I=index of the element whose address is to be calculated
L=Lower boundary of the array

Double dimensional array
In a double dimensional array the elements can be arranged in two ways. Row major order and column major order.
Row major order:
To calculate the address of cell the formula is
Address of A [ I ][ J ] = B + W * [ N * ( I – Lr ) + ( J – Lc ) ]
column major order.
To calculate the address of cell the formula is
Address of A [ I ][ J ] = B + W * [( I – Lr ) + M * ( J – Lc )]
Where B=Base address
W=size of the data type stored in the array
Lr=Lower bound of row
Lc=Lower bound of column
I= The index of the row
J=The index of column

Watch java videos

LEAVE A REPLY

Please enter your comment!
Please enter your name here