排序功能中的时间复杂度

问题描述

在python中,我们使用sort函数(例如,如果我们有一个list-a,则使用a.sort()对列表进行排序)。但是如何知道sort函数使用哪种类型的排序(冒泡,选择,插入等)。

解决方法

好吧,.sort python函数使用Timsort算法。您可以在这篇文章中了解更多-> About Python's built in sort() method