This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include<stdio.h>
int main()
{
int a[100];
int i,j,k;
int n;
scanf("%d",&n);
for(i = 0;i < n;i++)
scanf("%d",&a[i]);
}
for(i = 0;i < n - 1;i++)
k = i;
for(j = i + 1;j < n;j++)
if(a[j] > a[k])
k = j;
if(i != k)
int t = a[i];
a[i] = a[k];
a[k] = t;
printf("%d ",a[i]);
/**
时间复杂度: 选择法排序的时间复杂度为O(n2);
空间复杂度:选择法排序的空间复杂度为S(n);
**/