Professional Documents
Culture Documents
Expeimesl Noit
Am-To witeo proqram tor celechon cot
Theory' qeneally sd
Selechion sot is o corbing algoiHam small
fles wth arge eords and kes.
worce Ben uncetan inserhe sor
re
TRbniaue
Gnsideranayowithoelements
the smallest value in any ploce itis frst
posiben then tnd the secand smallest valve n sub-ongy
ond placetio cecond posihon fepesd onbl entite anray is Satd.
E-399I
al5) a[6] a
PADS POS alo] al) al2] al3al 2 18
39 9l45 22
42 39
2 18 90 22
45 39
27
t 27 39 90 22
72
5 18 39
t2 40
18 2 39
sersihveb m
Gmplehy Selechcn sot is not datto celect soallest pass
n-j om pariciens will be needed
elenent
Thus, the no.ot Gnpoicicns needed o soyt aiay wit
elementseln-)+ ln-2)+..t2+
2 2
Page No.
B
Disploy sorled
elements
Shop
Date:
int main()
int A[20],i,j,n, k;
int temp, Min ;
printf( "Enter Number of Elements:- ->");
scanf("%d", &n) ;
for (i=0;i<n;it+)
{ printf("\nEnter A[%d]:-->",i+1);
scanf("i%d", &A[i]);
for(i=0;isn-1;i++)
Min=i;
for(j=i+1;j<n;j++)
if (A[j]<A[Min])
Min=j;
}
temp=A[i];
A[i]=A[Min];
A[Min]=temp;
printf("\nOutput After Pass %d: - ->",i+1):
for (k=0;k<n;k++)
printf("%d",A[k] );
return 0;
**OUTPUT*
Enter A[1]:-->44
Enter A[2]: -->>88
Enter A[3]: -->98
Enter A[4]:-->25
Enter A[5]: -->11
Output After Pass 1: -->1188982544
Output After Pass 2:-->1125988844
Output After Pass 3:-->1125448898
Output After Pass 4: -->1125448898