准备复试上机的过程中,把自己之前对algorithm头中不了解的函数记录下来,第一篇就是排序的sort函数。 sort的一般格式为 int s[n]; sort(s,s+n); 默认使用快速排序将从s[0]到s[n-1]之间的内容升序排列 若想自定义排序可以自行编写compare函数 bool compare(type x,type y){return true} type s[n]; sort(s,s+n,compare); 其中,compare返回值为true时,表示x将排在y之前 参考《王道机试指南第二版》...