Arrays, Data Structure & Algorithms

This unit discussed about data structure called Arrays. The easiest form of array is a one-dimensional array which may be described as a finite ordered set of homogeneous elements that is stored in contiguous memory locations. For instance, an array might contain all integers or all characters or any data type, but might not contain a mix of data types.

The common form for declaring a single dimensional array is following:

data_type array_name[expression];

where data_type represents data type of the array. That is, char, integer, float etc. array_name is the name of expression and array which denoted the number of elements in the array.

For instance, assume the following C declaration:

int  a[100];

This declares an array of 100 integers.

The amount of storage needed to hold an array is related to its type and size directly. For a single dimension array, the overall size in bytes needed for the array is computed as illustrated below.

Memory needed (in bytes) = size of (data type) X length of array

The primary array index value is referred to as its lower bound & in C this is always 0 and the maximum index value is called as its upper bound. In the array the number of elements, called its range is given by upper bound-lower bound.

In the arrays we store values during program execution. Now Let us see the process of initializing an array while declaring it.

int a[4] = {34,60,93,2};

int b[] = {2,3,4,5};

float c[] = {-4,6,81,- 60};

We come to the following facts from these instance:

(i) If at the time of declaration the array is initialized, then the dimension of the array is optional.

(ii) Till the elements of array are not given any particular values, they have garbage values.

Posted Date: 4/4/2013 6:23:49 AM | Location : United States







Related Discussions:- Arrays, Assignment Help, Ask Question on Arrays, Get Answer, Expert's Help, Arrays Discussions

Write discussion on Arrays
Your posts are moderated
Related Questions
Draw trace table and determine output from the subsequent flowchart using below data:  X = 5, -3, 0, -3, 7, 0, 6, -11, -7, 12

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program

Binary search tree. A binary search tree is a binary tree that is either empty or in which every node having a key that satisfies the following conditions: - All keys (if an

Q. What do you understand by the term Hashing?  How do the collisions occur during hashing?  Explain the different techniques or methods for resolving the collision.

How divide and conquer technique can be applied to binary trees?  As the binary tree definition itself separates a binary tree into two smaller structures of the similar type,

Q. What is the smallest value of n such that an algorithm whose running time is 100n2 runs faster than an algorithm whose running time is 2n on the same machine.    A n

Thus far, we have been considering sorting depend on single keys. However, in real life applications, we may desire to sort the data on several keys. The simplest instance is that

need c++ algorithmic software program to derive one numerical outcome from 10 levels of variables with 135 combinations cross computed

Explain an efficient way of storing a sparse matrix in memory.   A matrix in which number of zero entries are much higher than the number of non zero entries is called sparse mat

one to many one to one many to many many to one