Lab: Sorting in practice

In this lab you will work with one partner, and implement Quicksort and Heapsort. For testing, generate random floating point or integer numbers, and test your code on inputs of size n=1000, 1M, 10M, 100M, 1B. Record your findings in a brief report.

Structuring your code

Troubleshooting

You may run into segfaults and memory issues, which you'll need to debug.

Segfaults are usually caused by accessing a bad address. Look for out-of-bounds array indices.

Something to look into is static versus dynamic allocation in C. It may be that you won't be able to statically allocate 1 billion floats. Perhaps. Something to look into and be aware.

As you work with big data, don't take for granted that your requests for memory are succesfull.

At some point the code will run into issues because it won't be able (maybe) to allocate as much memory as it wants. You want to handle this issue gracefully in your code (that is, check that when you request memory to be allocated, check that the request was actually succesfull).

There is lots of information on the web, use it!

Submitting your work

To submit,
  1. Email me the two files (only once per team, please).
  2. Print hard-copies of your code, attach the report with the findings, and hand it in.

Enjoy!


Last modified: Tue Mar 1 10:07:43 EST 2016