In a single dimensional array the address of an element of an array say A[i] is calculated using the following formula Address of $A[i] =B+W * (i–L_B)$ where $B$ is the base address of the array, W is the size of each element in bytes, i is the subscript of an element whose address is to be found and $L_B$ is the Lower limit / Lower Bound of subscript (if not specified assume 0).
Similarly, in the case of a two-dimensional array, the address of an element of any array say A[i][j] may be calculated in 2 methods depending upon what type of ordering the array follows. In case of Row Major System, the address of the location is calculated using equation while in case of Column Major System, the address of the location is calculated using the equation where, B = Base address, i = Row subscript of an element whose address is to be found, j = Column subscript of an element whose address is to be found, W = Storage Size of one element stored in the array (in byte), Lr = Lower limit of row/start row index of the matrix, if not given assume 0 (zero), Lc = Lower limit of column/start column index of the matrix, if not given assume 0 (zero), M = Number of rows of the given matrix, N = Number of columns of the given matrix.
Row Major:Address of $A[i][j] =B+W * [N * (i - L_r) +(j-L_c)] $
Column Major:Address of $A[i][j] =B+W*[(i – L_r)+M*(j -L_c)] $
So how can we devise an equation to find the address of the cell of a k-dimensional array considering the base address as B, Storage Size of one element stored in the array as W (in byte), $L_k$ as the lower limit of the kth dimension and $N_1, N_2…N_k$ be the dimension of the array along the kth direction?
My approach is as follows here:
If we see the formulae we understand that there is a certain the address of different dimensions follow a pattern
$A[i] =B+W*(i–L_B)$----->1 D Matrix
$A[i][j] =B+W * [N * (i - L_r) +(j-L_c)]$------->2 D Matrix(Row Major Formula,Where N is the 2nd index or the column,Mis the 1st index or the row number)
By the pattern here...
$A[i][j][k]=B+W * [(i - L_1)*n*p + p*(j-L_2) + (k-L_3)]$---->3 D Matrix with the 3 dimensions as m rows,n columns and p height variables.
Then how can we change this problem to an induction problem and proceed? Other ways to are welcome.
As I want to understand how this can go by induction that's why I have uploaded in maths StackExchange.