how to count comparison selectionsort? : how to count comparison selectionsort?
terms :
when the statements you perform to find the maximum value is 'true'
then count comparison.

The value to get the maximum value is held at the first element in the array, not at random.


i try with c
variable count position change - no work
new variable 'first' , first=sort[MAX] insert first for loop, - no work

    int main()
     {
        int sort[10000],i,n,MAX,temp,count,first;
        scanf("%d",&n);
        for(i=0;i<n;i++)
          {
           scanf("%d",&sort[i]);
        }
        for(MAX=0;MAX<n;MAX++)
        for(i=MAX+1;i<n;i++)
         {
             if(sort[MAX]>first)  
    		 {
    		 	count++;
                 temp=sort[MAX];
                 sort[MAX]=sort[i]; 
                 sort[i]=temp;
             }
        }
            printf("%d  ",count);
        return 0;
    }