Which sorting algorithm is used by STL's list::sort()?

后端 未结 3 1342
情话喂你
情话喂你 2020-12-05 09:45

I have a list of random integers. I\'m wondering which algorithm is used by the list::sort() method. E.g. in the following code:

list         


        
3条回答
  •  既然无缘
    2020-12-05 10:04

    Though is it implementation/vendor dependent, but most implementation I know uses Introsort whose best & worst case complexity is O(nlogn).

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

提交回复
热议问题