questionthe code below is used for answering -int


Question

The code below is used for answering -
int unknownAlgorithm(int a[], int k, int n){
int i,j, mini,tmp;
for(i=0; i< k; i++){
mini = i;
for(j= i+1; j < n; j++)
if(a[j] < a[mini])
mini=j;
tmp = a[i];
a[i]=a[mini];
a[mini]=tmp;
}
return a[k-1];
}

3a.What does above algorithm attain?

3b.What is best-case complexity of the algorithm? Clarify.

3c.What is worst-case complexity of the algorithm? Clarify.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questionthe code below is used for answering -int
Reference No:- TGS0443943

Expected delivery within 24 Hours