Algorithm Non_DC(A,n,max,min)
{
max<-min<-A[1];
for i<-2 to n
{
if(A[i]>max)
{
max<-A[i];
}
if(A[i]<min)
{
min<-A[i];
}
}
}
Let us assume a best case:
What’ll be the best case?
Let us assume a worst case:
What’s the worst case?