This is a trivial program that selects a series of numbers (1..n) to fill an array with no repitition in a random order. In the first program (shuffle.c), uses an O(n^2) algorithm that stupidly walks the array each time a new number is picked to see if the number is already in the array. If it finds a repeat it tries again and keeps repeating this step until a free number is found. The second program (fast-shuffle.c) does a time/memory trade-off to get an O(n) algorithm with an O(1) check time. This is done by creating a second array of equivilant size and tagging values as used in order as they get put into the main array. The result? Each time we pick a number, we know exactly where to check to see if it has already been used. The Makefile provided compiles both programs -- no real magic there. The programs have been compiled and tested under Linux although it should compile without hassle on any other OS including Windows. The timecards shell script allows you to run and collect data on how much CPU time it takes to run both programs with various numbers of cards (from 1000 to n-thousand). Simply run it with a parameter of how many thousand to test with. The timecards.output shows the output of "./timecards 50". Note that timecards.output will be overwritten each time you run timecards. If you want to save the timecards.output file after each run, be sure to rename it. results.gif is a graph of timecards.output. Note that this counts on the GNU time program being located at /usr/bin. You may need to change this program a little to make it work on your system. As you can see from results.gif, picking a good algorithm will make a bigger difference than brute force processing speed. I would have to run shuffle on a processor that is 100x faster to even begin getting close to the performance of fast-shuffle. Enjoy.