使用c 中的sort()函数对字符串进行排序的最坏情况是什么是什么
What is the worst case time complexity of sorting an array of strings using sort() function in c++?
示例
string input[3]={"Earth","Mars","Mercury"};
sort(input,input+3);
在C 11之前,复杂性平均为N.log(N)
,最坏的情况复杂性取决于您的标准库实现。对于该语言的以后版本,该标准要求复杂性正好为N.log(N)
。
来自https://en.cppreference.com/w/cpp/algorithm/sort:
复杂性
o(n·log(n((,其中
N = std::distance(first, last)
平均比较。(直到C 11( o(n·log(n((,其中N = std::distance(first, last)
比较。(由于C 11(
相关文章:
- 在 c++ 中对类中的 c 字符串动态数组进行排序的最佳方法是什么?
- 在 C++20 中对概念约束函数进行排序的规则是什么?
- 此气泡排序代码中的错误是什么?
- 在 C++ 中,以相反顺序排序的最快方法是什么?
- 使用c 中的sort()函数对字符串进行排序的最坏情况是什么是什么
- 随机化超大文件内容排序的有效方法是什么?
- 对这些 n^2 个数字进行排序的最快方法是什么
- 当有多个查询时,检查某些子数组是否排序的有效方法是什么?
- 从排序的数字数组中返回数字范围的最快方法是什么?
- 根据这些字符串输入在句子中的位置对这些字符串输入进行排序的更快方法是什么
- 根据特定数据对字符串进行排序的最佳方法是什么
- 交替对数组进行排序的最简单方法是什么(例如:T,T,F 到 T,F,T,T,T,T,F,T,F,F,T,T,
- 仅使用几乎相等的标准(无排序)从容器中删除重复项的最有效方法是什么
- 排序是什么意思
- 用sqlite和c++对数据库表进行排序的最佳方法是什么
- 对向量进行排序的最快方法是什么
- 对一组数字进行排序的最快数据结构(和排序算法)是什么
- 调用函数中的这些评估是什么,这些评估未在被调用函数的主体之前专门排序
- 在c++中,对某种列表进行排序的最快方法是什么
- 选择排序算法的标准是什么