PAT 1045 快速排序

来源:互联网 发布:上海地铁客流量数据 编辑:程序博客网 时间:2024/05/29 04:30

快速排序
题目链接

先用快速排序对数组进行排序,对原数组进行遍历
如果满足该数满足他是遍历过程中最大的,而且该数和排好序的数组中对应的元素相等就说名他是主元

int comp(const void *a,const void *b){    return *(int *)a - *(int *)b;}qsort(arr_s,N,sizeof(int),comp)
0 0