array
array
Representation
An Array is a Linear data structure which is a collection of data items having
similar data types stored in contiguous memory locations. By knowing the address
of the first item we can easily access all items/elements of an array.
Array Operation
Now that we know the basic idea behind an array, let us now look at the various
operations that can be performed on arrays.
One-Dimensional Array
Multi-Dimensional Array
In the two-dimensional array face [3] [4], the first index specifies the number
of rows and the second index specifies the number of columns and
the array can hold 12 elements (3 * 4).
Declaration/Initialization of Arrays
Applications of an array:
Apart from being widely used in programming, arrays have additional applications
as well:
1. Array representation
2. Linked list representation
Method 1: Using Arrays:
2D array is used to represent a sparse matrix in which there are three rows named
as
Row: Index of row, where non-zero element is located
Column: Index of column, where non-zero element is located
Value: Value of the non zero element located at index – (row,column)