c# – .NET List.sort()的时间复杂度是多少?

什么是C#的List< T> .sort()的时间复杂度

我想是(N)

但是,当我搜索很多,我没有得到任何准确的结果.

解决方法

http://msdn.microsoft.com/en-us/library/b0zbh7b6.aspx

This method uses Array.sort,which uses the QuickSort algorithm. This implementation performs an unstable sort; that is,if two elements are equal,their order might not be preserved. In contrast,a stable sort preserves the order of elements that are equal.

On average,this method is an O(n log n) operation,where n is Count; in the worst case it is an O(n ^ 2) operation.

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...