What is the space complexity of the python sort?

前端 未结 2 1670
深忆病人
深忆病人 2021-01-12 11:19

What space complexity does the python sort take? I can\'t find any definitive documentation on this anywhere

2条回答
  •  执念已碎
    2021-01-12 11:51

    Python's built in sort method is a spin off of merge sort called Timsort, more information here - https://en.wikipedia.org/wiki/Timsort.

    It's essentially no better or worse than merge sort, which means that its run time on average is O(n log n) and its space complexity is Ω(n)

提交回复
热议问题