Added src/sorting/scaling.py to test sort algorithm scaling vs. N.
[parallel_computing.git] / src / sorting / README
1 sorting
2 =======
3
4 Various sorting algorithms.
5
6 Manifest
7 --------
8
9 ===========  ===============================================
10 README       This file.
11 Makefile     Automate building and cleanup.
12 data.py      Generate random data for the 'data' file.
13 main.c/.h    Command line framework for a sorting algorithm.
14 bubble.c     Bubble sort algorithm for main.c/.h.
15 quicksort.c  Quicksort algorithm for main.c/.h.
16 ===========  ===============================================
17
18 Build
19 -----
20
21 Just run
22
23     $ make
24
25 which also builds a random data file 'data'.  To build with the DEBUG
26 macro defined (to enable some stderr printouts in main.c), run
27
28     $ make CFLAGS=-DDEBUG
29
30 Remove auto-generated files with
31
32     $ make clean
33
34 Usage
35 -----
36
37     $ ./qicksort data
38     $ ./bubble data
39
40 Timing
41 ------
42
43 Timing 8191 data points on my 571 MHz netbook with
44
45     $ time ./bubble data > /dev/null
46     $ time ./quicksort data > /dev/null
47
48 quicksort takes 0.075 s and bubble takes 3.994 s.
49
50 On ordered data bubble does much better
51
52     $ time ./bubble ordered-data > /dev/null
53     $ time ./quicksort ordered-data > /dev/null
54
55 quicksort takes 0.048 s and bubble takes 0.046 s.
56
57 You can generate scaling graphs for all executables built by the
58 Makefile with
59
60     $ make scaling
61
62 which generates `*-scaling.dat` and `*-scaling.png` for each
63 executable.