Selection Sort?

Untitled

Code

void selectionsort(int n, keytype S[])
{
	index i, j, smallest;
	
	for(i=0; i<n-1; i++){
		smallest = i;
		for(j=i+1; j<=n; j++){
			if(S[j] < S[smallest])
				smallest = j;
		}
		exchange S[i] and S[smallest];
	}
}

Time Complexity