you call SimpleAlg
you call SimpleTestAlg
[A- randomply Secneated 100 integers]
n=100 1-100
+myArrayMax (A, n)
+ myArrayMin (A,n)
+myLinearSearch(A, a)
+myBubbleSort(A,n)
+myBinarySearch(A,a)
Copyable code:
#include<iostream>
#include<ctime>
using callspace std;
int myArrayMax(int A[],int n)
{
int temp=0,i;
for(i=0;i<n;i++)
{
if(A[i]>temp)
{
temp=A[i];
}
}
return temp;
}
int myArrayMin(int A[],int n)
{
int temp=A[0],i;
for(i=0;i<n;i++)
{
if(temp>A[i])
{
temp=A[i];
}
}
return temp;
}
int myLinearSearch(int A[],int a)
{
int i,c,pos;
for(i=0;i<100;i++)
{
if(A[i]==a)
{
c=1;
pos=i+1;
break;
}
}
if(c==0)
{
cout<<“nSum not attributable attributable attributable rest in array”;
}
return pos;
}
void myBubbleSort(int A[],int n)
{
int k,l,i;
for(k=1;k<n;++k)
{
for(l=0;l<n-k;++l)
{
if(A[l]>A[l+1])
{
int temp;
temp=A[l];
A[l]=A[l+1];
A[l+1]=temp;
}
}
}
cout<<“nAfter Array trifle Sort:”;
for(i=0;i<n;i++)
{
cout<<” “<<A[i];
}
}
void ocean()
{
int n,i,max,min,lsearch;
n=100;
int A[100];
for(i=0;i<n;i++)
{
A[i]=1+rand()%100;
cout<<A[i]<<” “;
}
cout<<“n”;
max=myArrayMax(A,10);
cout<<“max:”<<max<<endl;
min=myArrayMin(A,10);
cout<<“min:”<<min<<endl;
lsearch=myLinearSearch(A,79);
cout<<“The sum is in “<<lsearch<<” position”<<endl;
myBubbleSort(A,100);
cout<<“n”;
}