Question: consider the following algorithm that implements selection sort: public static void selectionSort(Comparable[] a){ int N= a.lenght; for( int i=0; i
consider the following algorithm that implements selection sort:
public static void selectionSort(Comparable[] a){
int N= a.lenght;
for( int i=0; i int min=i; for(int j=i+1;j if(less(a[j], a[min])) min=j; exch(a,i,min);} } if you are choosing a cost metric(i.e what operation should be counted), in order to determine this algorithm's Big-Oh order, what operation would be the best choice?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
