个人博客地址: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?