Professional Documents
Culture Documents
Presentation by
Pawan Tak (PGT Comp Sci )
KV Sabarmati A’md
ARRAY
int temp[15];
0 1 2 3 4
Temp 30 30 35 34 26
1st
2nd
Element
Element
1000 1002 1004 1006 1008
One Dimensional Array
A one dimensional array is a list of variables that are
all of the same type and are referred through a
common name. An individual variable in the array is
called an array element.
45 15 16 2 6
2 45 15 16 6
2 6 45 15 16 Smallest
2 6 15 45 16 Smallest
2 6 15 16 45
6 2 16 15 45
2 6 16 15 45 Smallest
2 6 16 15 45
2 6 15 16 45
2 6 15 16 45
Selection Sort
Void selsort(int A[ ], int size)
{
int small, pos, tmp;
for(int i = 0; i<size; i++)
{
small = A[i];
pos = i;
for (int j = i+1; j<size; j++)
{ if(A[j]<small)
{
small = A[j]
pos = j;
}
}
tmp = A[i];
A[i] = A[pos];
A[pos] = tmp;
}
}
Bubble Sort
}
Two Dimensional Array
A two dimensional array is an array in which
Each element itself is an array. For example
0 1 2