Update links to plot_image.py.
[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 scaling.py   Script to generate time-scaling data.
14 main.c       Command line framework for a sorting algorithm.
15 sort.h       Header declaring sort function syntax.
16 bubble.c     Bubble sort implementation of sort.h.
17 quicksort.c  Quicksort implementation of sort.h.
18 ===========  ===============================================
19
20 Build
21 -----
22
23 Just run
24
25     $ make
26
27 which also builds a random data file 'data'.  To build with the DEBUG
28 macro defined (to enable some stderr printouts in main.c), run
29
30     $ make CFLAGS=-DDEBUG
31
32 Remove auto-generated files with
33
34     $ make clean
35
36 Usage
37 -----
38
39     $ ./quicksort data
40     $ ./bubble data
41
42 Timing
43 ------
44
45 Timing 8191 data points on my 571 MHz netbook with
46
47     $ time ./bubble data > /dev/null
48     $ time ./quicksort data > /dev/null
49
50 quicksort takes 0.075 s and bubble takes 3.994 s.
51
52 On ordered data bubble does much better
53
54     $ time ./bubble ordered-data > /dev/null
55     $ time ./quicksort ordered-data > /dev/null
56
57 quicksort takes 0.048 s and bubble takes 0.046 s.
58
59 You can generate scaling graphs for all executables built by the
60 Makefile with
61
62     $ make scaling
63
64 which generates `*-scaling.dat` and `*-scaling.png` for each
65 executable.