A sorting laboratory

The problem

Build a program that runs several sorting algorithms on the same data and reports exactly how much work each one did.

Requirements

Technologies

Step by step

  1. Write a function that fills an array with one of the four kinds of data.
  2. Write each sort so that it adds to shared counters for comparisons and moves.
  3. Write a function that copies the data, runs one sort, and checks the result.
  4. Store the sorts in an array of function pointers, so that one loop can run them all.
  5. Print a table for each kind of data and each size.
  6. Run sizes that double, such as 1,000, 2,000 and 4,000, and compare how each count grows.

Expected result

A tool that shows, with real counts, which sort does the least work on which kind of data.

How it is evaluated

Ways to improve it