DATA STRUCTURE
ARRAY
ARRAY:
Array is a composite or non-primitive data type, that is, it is made up of simpler
data types.
– Array is a data structure that organizes a collection of data of the same
data type using consecutive memory cells.
– Array is a list of finite number ‘n’ of homogeneous data elements,
where:
The elements of the array are stored in successive memory locations.
The elements of the array are referenced by an index. Index values are
‘n’ consecutive numbers.
Arrays exists in most programming languages and operations of this data
structure are already implemented by those programming languages.
, Each array element occupies the same number of memory cells (bytes).
Array data structure is used when the number of elements are fixed.
Operations like traversal, searching and sorting can be easily performed on
Array.
The number of elements in an array is called the Length or Size of the Array.
The size of array is specified at creation or declaration of the array.
Index consists of integers 0,1,2,3…, n.
Index is mostly represented by a number in brackets after name of the array,
e-g.
– x [0], x [1], x [2], x [3], x [4], x [5]
The name of the array is a pointer to first value. That is, name of an array stores
address of first memory.
Arrays can be
– One dimensional array
Array with one index. A [1]
– Two-dimensional array
Array with two indexes. A [1][2]
– Or n-dimensional
One Dimensional Array:
The array in which there is only one dimension is called one dimensional array.
One dimensional array is also called a list or a linear array it consists of only one
row or one column e.g., Int x [5];
Length or size of the One-Dimensional Array:
Total number of elements in the ODA is called the length of the One-Dimensional
Array.
ARRAY
ARRAY:
Array is a composite or non-primitive data type, that is, it is made up of simpler
data types.
– Array is a data structure that organizes a collection of data of the same
data type using consecutive memory cells.
– Array is a list of finite number ‘n’ of homogeneous data elements,
where:
The elements of the array are stored in successive memory locations.
The elements of the array are referenced by an index. Index values are
‘n’ consecutive numbers.
Arrays exists in most programming languages and operations of this data
structure are already implemented by those programming languages.
, Each array element occupies the same number of memory cells (bytes).
Array data structure is used when the number of elements are fixed.
Operations like traversal, searching and sorting can be easily performed on
Array.
The number of elements in an array is called the Length or Size of the Array.
The size of array is specified at creation or declaration of the array.
Index consists of integers 0,1,2,3…, n.
Index is mostly represented by a number in brackets after name of the array,
e-g.
– x [0], x [1], x [2], x [3], x [4], x [5]
The name of the array is a pointer to first value. That is, name of an array stores
address of first memory.
Arrays can be
– One dimensional array
Array with one index. A [1]
– Two-dimensional array
Array with two indexes. A [1][2]
– Or n-dimensional
One Dimensional Array:
The array in which there is only one dimension is called one dimensional array.
One dimensional array is also called a list or a linear array it consists of only one
row or one column e.g., Int x [5];
Length or size of the One-Dimensional Array:
Total number of elements in the ODA is called the length of the One-Dimensional
Array.