在哪里可以找到几个重要的排序算法测试用例?

发布于 2024-12-28 10:22:17 字数 621 浏览 2 评论 0原文

我想根据我的一些想法开发一种非常有效的排序算法。问题是我想根据现有的大多数备受赞赏的排序算法来测试我的算法的效率。

理想情况下,我希望找到:

  • 大量的排序测试,对于为我提供算法的效率而言非常重要
  • 大量已经存在且高度优化的排序算法(及其代码 - 无论语言)
  • 甚至更好,为排序算法开发人员提供足够环境的软件

这是我之前发现的一篇文章,其中包含 2 个表,其中比较了 timsort、quicksort、dual-pivot fastsort 和 java 6 sort:http://blog.quibb.org/2009/10/sorting-algorithm-shootout/ 我可以在这些表中看到这些 TXT 文件(从 1245.repeat.1000.txt 到equential.10000000.txt)包含这些算法的测试用例,但我在任何地方都找不到原始 TXT!

任何人都可以向我指出许多排序测试用例和/或许多高效排序算法的链接吗? (这是我最感兴趣的测试用例,排序算法遍布互联网)

提前非常感谢!

I want to develop a very efficient sorting algorithm based on some ideas that I have. The problem is that I want to test my algorithm's efficiency against the majority highly appreciated sorting algorithms that already exist.

Ideally I would like to find:

  • a large bunch of sorting tests that are SIGNIFICANT for providing me with the efficiency of my algorithm
  • a large set of already existing and strongly-optimized sorting algorithms (with their code - no matter the language)
  • even better, software that provides adequate environment for sorting algorithms developers

Here's a post that I found earlier which contains 2 tables with comparisons between timsort, quicksort, dual-pivot quicksort and java 6 sort: http://blog.quibb.org/2009/10/sorting-algorithm-shootout/
I can see in those tables that those TXT files (starting from 1245.repeat.1000.txt on to sequential.10000000.txt) contain the test cases for those algorithms, but I can't find the original TXT's anywhere!

Can anyone point me to any link with many sorting test-cases AND/OR many HIGHLY EFFICIENT sorting algorithms? (it's the test cases I am interested in the most, sorting algorithms are all over the internet)

Thank you very much in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是在用心讲痛 2025-01-04 10:22:17

有几点:

  • 快速排序对正向和反向排序列表很疯狂,因此它需要其他列表类型。
  • 对随机数据进行测试很好,但如果您想比较不同算法的性能,这意味着您无法每次都生成新的随机数据,否则您的结果将不可靠。我认为您应该尝试提出一种伪“随机”算法,该算法按照基于条目数的顺序写入数据。这样,为大小为 n、10n 和 100n 的列表生成的数据将相似。
  • 排序测试主要不是关于速度(直到算法最终确定),而是与条目的比较比率。如果一种排序需要列表中每个条目 15 次比较,而同一列表需要另外 12 次比较,则第二种排序会更高效,即使它的执行时间是两倍。对于更琐碎的排序概念,必要的交换次数也将发挥作用。
  • 为了进行测试,使用 RAM 中的整数向量。如果该算法运行良好,则可以将整数向量转换为索引向量,并将其放入包含要比较的数据的缓冲区中。这样的算法将根据它们指向的数据对因数向量进行排序。

A few things:

  • Quicksort goes nuts on forward- and reverse sorted lists so it will need other list types.
  • Testing on random data is fine, but if you want to compare the performance of different algorithms that means you cannot generate new random data every time or your results won't be reliable. I think you should try to come up with a pseudo"random" algorithm that writes data in in an order that is based on the number of entries. That way the data generated for lists of size n, 10n and 100n will be similar.
  • Testing of sorting is not primarily about speed (until an algorithm has been finalized) but the ratio of comparisons to entries. If one sort requires 15 comparisons per entry in a list and another 12 for the same list the second will be more efficient even if it executed in twice the time. For the more trivial sorting concepts the number of exchanges necessary will also come into play.
  • For testing use a vector of integers in RAM. If the algorithm works well the vector of integers can be translated to a vector of indeces into a buffer containing data to be compared. Such an algorithm would sort the vector of indeces based on the data they point to.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文