简体   繁体   English

排序函数的时间复杂度

[英]Time complexity in sort function

In python we use the sort function (example if we have a list-a then we use a.sort() to sort that list).在 python 中,我们使用 sort 函数(例如,如果我们有一个 list-a,那么我们使用 a.sort() 对该列表进行排序)。 But how to know that the sort function uses which type of sort (bubble,selection,insertion,etc).但是如何知道排序函数使用哪种类型的排序(冒泡、选择、插入等)。

Well, the .sort python function uses the Timsort algotithm.好吧, .sort python 函数使用Timsort算法。 You can learn more in this post --> About Python's built in sort() method您可以在这篇文章中了解更多信息 --> 关于 Python 的内置 sort() 方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM