Which sorting algorithm is used by .NET's Array.Sort() method?

前端 未结 6 733
悲&欢浪女
悲&欢浪女 2021-02-12 15:44

Which sorting algorithm is used by .NET\'s Array.Sort() method?

6条回答
  •  南方客
    南方客 (楼主)
    2021-02-12 15:58

    Quick sort as mentioned. But it does not equally well for all data!

    By using reflector: it does sort in a native dll -> for the most common case of 1D arrays, ascending order. However, other cases are sorted in managed code - with very little optimizations applied. Hence their speed is usually much slower.

提交回复
热议问题