c++ stl 排序
STL sot功能 (STL sot function)
C++ STL has a default sort function which sort an array or vector in increasing order. Normally it uses quick sort which has a worst case time complexity of O(n^2) and average of O(nlogn).
C ++ STL具有默认的排序功能 ,可以按递增顺序对数组或向量进行排序。 通常,它使用快速排序,这种排序的最坏情况是时间复杂度为O(n ^ 2)和平均值为O(nlogn) 。
To sort an array:
排序数组:
Let the array be a[n] that mean the length of the array is n. To sort the array we need to write sort(a,a+n);
令数组为a [n]表示数组的长度为n 。 要对数组进行排序,我们需要编写sort(a,a + n);