比较程序排序时出现问题 [英] problem in sorting Comparison program

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

问题描述

为什么在此代码选择排序中比快速排序更快?
<a href="http://www.codeproject.com/KB/recipes/SortVisualization.aspx">Visualization and Comparison of sorting algorithms in C#</a>[<a href="http://www.codeproject.com/KB/recipes/SortVisualization.aspx" target="_blank" title="New Window">^</a>]

why in this code selection sort is faster than quick sort?
<a href="http://www.codeproject.com/KB/recipes/SortVisualization.aspx">Visualization and Comparison of sorting algorithms in C#</a>[<a href="http://www.codeproject.com/KB/recipes/SortVisualization.aspx" target="_blank" title="New Window">^</a>]

推荐答案

我可能是因为那篇文章中的算法所做的不只是排序.例如更新UI方面.这不是比较排序算法的方式,因为它会使结果失真.

我不会使用该特定应用程序,因为排序速度似乎会根据您的算法在UI中的哪一侧而改变,而右边的那个总是对我而言似乎总是更快.

/Fredrik
I could be because the algorithms in that article does a lot more than sort. Such as updating the UI aspects as well. That''s not how you compare sorting algorithms as it can distort the results.

I wouldn''t use that perticular application as the sorting speed seems to change depending on which side your algorithm is on in the UI, the one on the right always seems faster too me.

/Fredrik


这篇关于比较程序排序时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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