XDU算法实验:排序算法实验性能比较

这篇博客探讨了五种不同的排序算法——插入排序、自顶向下归并排序、自底向上归并排序、随机快速排序和Dijkstra三路划分快速排序——在不同规模输入数据上的性能。实验结果显示,对于已排序或近乎排序的数据,特定排序算法表现出优越的效率。文章通过10次运行的平均时间展示了每种算法的性能,并讨论了数据初始顺序如何影响排序速度。此外,还提供了算法实现的源代码链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

Run1Run2Run3Run4Run5Run6Run7Run8Run9Run10Average
IS
TDM
BUM
RQ
QD3P
  • 回答以下问题:
  1. Which sort worked best on data in constant or increasing order (i.e., already sorted data)? Why do you think this sort worked best?

​ 哪种排序对不变或递增顺序的数据(即已经排序的数据)最有效?为什么你认为这种方法效果最好?

  1. Did the same sort do well on the case of mostly sorted data? Why or why not?

​ 同样的排序在排序最多的数据中表现良好吗?为什么或为什么不?

  1. 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.

​ 一般来说,传入数据的排序会影响排序算法的性能吗?

​ 请在回答这个问题时引用表格中的具体数据来支持你的答案。

  1. 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.

  2. In general, which sort did better? Give a hypothesis as to why the difference in performance exists.

  3. 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?

二、算法实验报告+源代码

实验报告+代码开源地址(Github)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值