## 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