Monday, September 9, 2013

Introduction of Array

This is the basic or simplest type of data structure. An array can be defined as, a list of a finite number "n" of similar data elements referenced respectively by a set of n consecutive numbers, usually 1, 2, 3, ..., n.

If A is chosen for the name of some array, then the elements of A are denoted as,
a1, a2, a3, a4, ..., an
OR  A(1), A(2), A(3), A(4), ..., A(n)
OR  A[1], A[2], A[3], A[4], ..., A[n]

Regardless of the notation, the number K in A[K] is called a subscript and A[K] is called a subscripted variables.

There are some important points related to array:
  • Data type may be either fundamental data type or user defined data type.
  • Array may be any valid variable name.
  • Size of array is numeric value which defines the size of the array.
Array can be 1- dimensional and multidimensional. Usually 2 - dimensional array is called as matrix.

2 - D Array can be implemented in memory in 2 ways:
  1. Row major order implementation
  2. Column major order implementation

0 comments:

Post a Comment