What is the time complexity of std::sort() in the C++ standard library?

后端 未结 6 787
暗喜
暗喜 2020-12-23 11:57

What is the complexity of std::sort() in the C++ Standard Library? Which sort is applied? Is there any rule of applying any particular sorting algorithm there?<

6条回答
  •  情话喂你
    2020-12-23 12:13

    The complexity is O(n log n). Some common implementations use introsort as far as I know:

    http://en.wikipedia.org/wiki/Introsort

提交回复
热议问题