Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

template<class Type>
int Impala::Util::Partition ( Type *  data,
int  left,
int  right 
)

Note:
right is inclusive

Definition at line 39 of file QuickSort.h.

Referenced by QuickSort().

00040 {
00041         Type val = data[left];
00042         int lm = left-1;
00043         int rm = right+1;
00044         for(;;)
00045     {
00046                 do
00047                         rm--;
00048                 while (data[rm] > val);
00049         
00050                 do 
00051                         lm++;
00052                 while(data[lm] < val);
00053 
00054                 if(lm < rm)
00055         {
00056                         Type tempr = data[rm];
00057                         data[rm] = data[lm];
00058                         data[lm] = tempr;
00059                 }
00060                 else 
00061                         return rm;
00062         }
00063 }


Generated on Thu Jan 13 09:24:06 2011 for ImpalaSrc by  doxygen 1.5.1