数组排序 [英] Array.Sort

查看:85
本文介绍了数组排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



您能否解释一下Array.Sort()方法使用DataStrcutures的排序机制.我希望它是基于Bubble sort()完成的.如果我错了,请纠正我.

谢谢,
问候.

Hi,

Can you please explain Array.Sort() method uses which sorting mechanism of DataStrcutures. i Hope it was done based on Bubble sort(). please correct me if i am wrong.

Thanks,
Regards.,

推荐答案


Array.Sort不是基于某些算法,而是基于 IComparable 接口,请检查此msdn网站以获取详细信息
Hi
Array.Sort is not based on some algorithm, it is based on IComparable Interface, please check this msdn site for details


看看自己在Array中使用了什么.在这里排序:
MSDN Array.Sort() [ ^ ]

如果您知道什么是冒泡排序,那么您应该知道时间&它的空间复杂度不好.有比这更好的算法.
如果Microsoft使用任何算法进行排序,那么他们会使用性能不佳的算法吗?
它使用IComparable接口.您可以在上面的链接中找到实现示例.
Have a look yourself about what is used in Array.Sort here:
MSDN Array.Sort()[^]

If you know what Bubble Sort is, you should know that the time & space complexities of it is not good. There are better algorithms than that.
If Microsoft used any algorithm for sorting then they would they use a bad performance algo?
It uses IComparable interface. You can find the implementation example in the above link.


这篇关于数组排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆