Array Representation in Data Structure


An array is defined as a finite ordered set of homogeneous elements. Finite means that there is a specific number of elements and order means that the elements of the array are indexed. Homogeneous means that all the elements of the array must be of the same type.

Array Representation:

In the Data Structure, there are two types of array representation exist:

i. One Dimensional Array

ii. Two-Dimensional Array

One Dimensional Array:

Values in a mathematical set are written as shown below:
a={5, 7, 9, 4, 6, 8}
These values are referred to in mathematics as follows:
a0, a1, a2
In Data Structure, these numbers are represented as follows:
a[0], a[1], a[2]
these values are stored in RAM.

Algorithm for insertion into One-dimensional array:

Algorithm fnInsertion_1D_Array(arrData, n, k, item)

Algorithm for deletion from One-dimensional array:

Algorithm fnDeletion_1D_Array(arrData, n, k)
return item;

Algorithm for traversing One-dimensional array:

Algorithm fnTraverse_1D_Array(arrData, n)
print arrData[i];

Two-Dimensional Array:

Two-Dimensional Array
These values are referred to in mathematical as follows:
A0,0 A0,1 A0,2

In Data Structure, they are represented as follows:
a[0][0] a[0][1] a[0][2] and so on
It may be imagined that these values are stored in the RAM.