Dedicated to Dosen Roy.
Algoritma sequensial sorting, searching,
Nilai Minimum dan Nilai Maksimum.
//Proses pencarian data terkecil
min=0;
for(i=0;i<=n-2;i++)
{
if (A[min]> A[i+1])
{
min = i+1;
}
}
cout<<"Data terkecil : "<<A[min] <<endl;
//Proses pencarian data terbesar
max=0;
for(i=0;i<=n-2;i++)
{
if (A[max]< A[i+1])
{
max = i+1;
}
}
cout<<"Data terbesar : "<<A[max] <<endl;
No comments:
Post a Comment