In python we use the sort function (example if we have a list-a then we use a.sort() to sort that list). But how to know that the sort function uses which type of sort (bubble,selection,insertion,etc).
Asked
Active
Viewed 3,006 times
1 Answers
0
Well, the .sort
python function uses the Timsort algotithm. You can learn more in this post --> About Python's built in sort() method

Manu Sampablo
- 350
- 5
- 17
-
i was solving a question in which expected time complexity was O(N) and i used .sort function. According to Timsort the time complexity is O(n logn). So if i used the .sort function ( as it uses Timsort function the time complexity is nlogn ) it should not have accepted my solution but it did accept – Soham Oct 29 '20 at 05:41
-
@Soham No, if you see at the right side of the wikipedia timsort page, in the Best-Case performance the time complexity is O(n) and not O(n log n). – Manu Sampablo Oct 29 '20 at 06:33