跟打练习 难度 2
手写冒泡要 5 行,sort 只要 1 行!还有更快的秘密:它的速度是 O(n log n)。
sort(a, a+n) 把区间 [0, n) 从小到大排好,需要 #include <algorithm>。比赛里能用 sort 就别手写排序。