Search This Blog

Sunday, May 10, 2009

Array

Array
It is a static data structure. It is a homogeneous collection of data. The elements in the array are stored on consecutive memory locations. Array is also known as a subscripted variable, e.g., A[i] is ith element of the array A (i.e., i is the subscript with variable A). As we know that the elements of the array are stored on consecutive memory locations, it becomes convenient to find out the address of memory location of ith element, for given base address (address of first element) and W (i.e. the number of memory locations required by one element).
Different Operations on 1 D ARRAYS
Creation
Traversal
Inserting an element
Deletion an element
Searching
Linear
Binary Search

Sorting
Bubble Sorting
Selection Sorting
Insertion Sorting

Merging
Different Operations on 2 D ARRAYS
Creation
Printing (Traversal)
Addition of two Matrix
Difference Matrix
Multiplication of Matrix
Row / Col Sum and row/column product
Diagonal Sum / printing diagonal element
Transpose Matrix