一、快速排序

Ⅰ. 格式

sort(arr+m,arr+n,cmp);

将数组 $ arr $ 中下标为 $ m $ 的元素到下标为 $ n-1 $ 的元素,按照定义的函数 $ cmp $ 中的规则排序。

Ⅱ. 排序规则

int cmp(const int &a,const int &b)
{
    return a>b;
}

如上的排序规则为从大到小排序,当 $ a=b $ 时应返回 $ 0 $ 。可以对结构体排序。

必须包含头文件 algorithm\color{red} {algorithm}