个人博客地址:https://travis1024.github.io/
一、问题描述
实现插入排序(Insertion Sort,IS),自顶向下归并排序(Top-down Mergesort,TDM),自底向上归并排序(Bottom-up Mergesort,BUM),随机快速排序(Random Quicksort,RQ),Dijkstra 3-路划分快速排序(Quicksort with Dijkstra 3-way Partition,QD3P)。在你的计算机上针对不同输入规模数据进行实验,对比上述排序算法的时间性能。要求对于每次输入运行10次,记录每次时间,取平均值。
Comparison of running time of sorting algorithms (in Micro Seconds)
| Run1 | Run2 | Run3 | Run4 | Run5 | Run6 | Run7 | Run8 | Run9 | Run10 | Average | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| IS | |||||||||||
| TDM | |||||||||||
| BUM | |||||||||||
| RQ | |||||||||||
| QD3P |
- 回答以下问题:
- Which sort worked best on data in constant or increasing order (i.e., already sorted data)? Why do you think this sort worked best?
哪种排序对不变或递增顺序的数据(即已经排序的数据)最有效?为什么你认为这种方法效果最好?
- Did the same sort do well on the case of mostly sorted data? Why or why not?
同样的排序在排序最多的数据中表现良好吗?为什么或为什么不?
- In general, did the ordering of the incoming data affect the performance of the sorting algorithms? Please answer this question by referencing specific data from your table to support your answer.
一般来说,传入数据的排序会影响排序算法的性能吗?
请在回答这个问题时引用表格中的具体数据来支持你的答案。
-
Which sort did best on the shorter (i.e., n = 1,000) data sets? Did the same one do better on the longer (i.e., n = 10,000) data sets? Why or why not? Please use specific data from your table to support your answer.
-
In general, which sort did better? Give a hypothesis as to why the difference in performance exists.
-
Are there results in your table that seem to be inconsistent? (e.g., If I get run times for a sort that look like this {1.3, 1.5, 1.6, 7.0, 1.2, 1.6, 1.4, 1.8, 2.0, 1.5] the 7.0 entry is not consistent with the rest). Why do you think this happened?
排序算法性能比较与实现
这篇博客探讨了五种不同的排序算法——插入排序、自顶向下归并排序、自底向上归并排序、随机快速排序和Dijkstra三路划分快速排序——在不同规模输入数据上的性能。实验结果显示,对于已排序或近乎排序的数据,特定排序算法表现出优越的效率。文章通过10次运行的平均时间展示了每种算法的性能,并讨论了数据初始顺序如何影响排序速度。此外,还提供了算法实现的源代码链接。
942

被折叠的 条评论
为什么被折叠?



