That may sound trivial, but do any of you know where I could find a database of test cases for sorting algorithms? It's common to test sorting algorithms on corner cases or with datasets with specific patterns (sorted values, decreasing values, pipe organ pattern...). Note that I am interested in regular sorting, not in external sorting.

Where can I find an open database of integers series to test sorting algorithms?

Update: I guess that some of you might be interested in how I eventually solved the problem. I wrote functions to generate the data for me instead of relying of fixed data sets. The result is a bit specific to my project but here it is: https://github.com/Morwenn/cpp-sort/blob/develop/testsuite/distributions.h


There is a project called Sort Benchmark that runs yearly competitions for different benchmarks. You can find the definitions under the section Sort Benchmarks, where each type has a link to the definitions. Data is generated with the gensort algorithm.

enter image description here

  • Unfortunately Sort Benchmark is all about external sorting, which isn't at all what I had in mind when I asked the question. I was thinking about regular sorting agorithms :/
    – Morwenn
    Dec 16 '15 at 12:38
  • You should update the question, which will bring it to the front of the queue and maybe more attention.
    – philshem
    Dec 17 '15 at 7:47

May A million random digits suit your purpose? This now belongs to the history of the RAND corporation. You can as well access random.org through its JSON-RPC API to automated random lists.

  • 1
    Comma-separated values would be ideal. Sep 15 '19 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.