Go to the source code of this file.
Functions | |
| exchange (int *x, int *y) | |
| main () | |
| int | partition (a, i, j) |
| putd (n) | |
| quick (a, lb, ub) | |
| sort (a, n) | |
Variables | |
| int | in [] = {10, 32, -1, 567, 3, 18, 1, -51, 789, 0} |
| int * | xx |
|
||||||||||||
|
Definition at line 60 of file sort.c. References printf(), t, x, xx, and y. Referenced by partition(). 00060 {
00061 int t;
00062
00063 printf("exchange(%d,%d)\n", x - xx, y - xx);
00064 t = *x; *x = *y; *y = t;
00065 }
|
Here is the call graph for this function:

|
|
Definition at line 3 of file sort.c. References i, in, putchar, putd(), and sort(). 00003 {
00004 int i;
00005
00006 sort(in, (sizeof in)/(sizeof in[0]));
00007 for (i = 0; i < (sizeof in)/(sizeof in[0]); i++) {
00008 putd(in[i]);
00009 putchar('\n');
00010 }
00011 return 0;
00012 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 44 of file sort.c. References a, exchange(), i, j, k, and v. Referenced by quick(). 00044 {
00045 int v, k;
00046
00047 j++;
00048 k = i;
00049 v = a[k];
00050 while (i < j) {
00051 i++; while (a[i] < v) i++;
00052 j--; while (a[j] > v) j--;
00053 if (i < j) exchange(&a[i], &a[j]);
00054 }
00055 exchange(&a[k], &a[j]);
00056 return j;
00057 }
|
Here is the call graph for this function:

|
|
Definition at line 15 of file sort.c. Referenced by main(). 00015 {
00016 if (n < 0) {
00017 putchar('-');
00018 n = -n;
00019 }
00020 if (n/10)
00021 putd(n/10);
00022 putchar(n%10 + '0');
00023 }
|
|
||||||||||||||||
|
Definition at line 33 of file sort.c. References a, k, and partition(). Referenced by sort(). 00033 {
00034 int k, partition();
00035
00036 if (lb >= ub)
00037 return;
00038 k = partition(a, lb, ub);
00039 quick(a, lb, k - 1);
00040 quick(a, k + 1, ub);
00041 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 28 of file sort.c. References a, n, quick(), and xx. 00028 {
00029 quick(xx = a, 0, --n);
00030 }
|
Here is the call graph for this function:

|
|
|
|
1.3.9.1