Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

sort.c File Reference

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


Function Documentation

exchange int *  x,
int *  y
 

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:

main  ) 
 

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:

int partition ,
i  ,
j 
 

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:

putd n   ) 
 

Definition at line 15 of file sort.c.

References n, and putchar.

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 }

quick ,
lb  ,
ub 
 

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:

sort ,
n 
 

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:


Variable Documentation

int in[] = {10, 32, -1, 567, 3, 18, 1, -51, 789, 0}
 

Definition at line 1 of file sort.c.

Referenced by __BigFloat(), __VectorNormalize(), _Vector53Copy(), _VectorCopy(), _VectorScale(), AxisCopy(), BigFloat(), Brush_SplitBrushByFace(), Brush_Subtract(), CG_AdjustPositionForMover(), checkuid(), ChopWinding(), ChopWindingInPlace(), ClientCleanName(), ClipWindingEpsilon(), CMod_LoadBrushes(), CMod_LoadBrushSides(), CMod_LoadLeafBrushes(), CMod_LoadLeafs(), CMod_LoadLeafSurfaces(), CMod_LoadNodes(), CMod_LoadPatches(), CMod_LoadPlanes(), CMod_LoadShaders(), CMod_LoadSubmodels(), ColorNormalize(), COM_Compress(), Com_StripExtension(), COM_StripExtension(), CopyString(), CreatePassages(), CreateTerrainSurface(), doAddress(), doDefaddress(), doDefconst(), doDefconstf(), doDeflabel(), doDefstring(), doExport(), doForest(), doFunction(), doGlobal(), doImport(), doLocal(), doSegment(), doSpace(), dumpcover(), FloatSwap(), G_FilterPacket(), GetVertexnum(), GlobalVectorToLocal(), HL_DecompressVis(), interface(), IntersectBrush(), InvertMesh(), LinearSubdivideMesh(), main(), MakeMeshNormals(), NormalizeColor(), PassageChopWinding(), Patch_MeshNormals(), PM_ClipVelocity(), PutMeshOnCurve(), Q2_DecompressVis(), Q_rint(), QE_ExpandBspString(), R_ColorShiftLightingBytes(), R_LoadMarksurfaces(), R_LoadNodesAndLeafs(), R_LoadPlanes(), R_LoadShaders(), R_LoadSubmodels(), R_LoadSurfaces(), R_MipMap(), R_MipMap2(), R_MirrorPoint(), R_MirrorVector(), RemoveLinearMeshColumnsRows(), ResampleTexture(), SanitizeString(), Sin_DecompressVis(), SplitMeshByPlane(), strlower(), strupr(), SubdivideMesh(), SubdivideMeshQuads(), SubtractBrush(), SV_ExpandNewlines(), TransposeMesh(), Vec10Copy(), Vector4Scale(), CXYWnd::VectorCopyXY(), VectorNormalize(), VectorNormalize2(), VectorRotate(), VisChopWinding(), VL_ChopWinding(), VL_SplitWinding(), VS_ChopWinding(), VS_SplitWinding(), Winding_Clip(), and Winding_SplitEpsilon().

int* xx
 

Definition at line 25 of file sort.c.


Generated on Thu Aug 25 15:57:34 2005 for Quake III Arena by  doxygen 1.3.9.1