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

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

Note:
right is inclusive

Definition at line 169 of file QuickSort.h.

Referenced by QuickSortCo().

00170 {
00171         Type val = data[left];
00172         int lm = left-1;
00173         int rm = right+1;
00174         for(;;)
00175     {
00176                 do
00177                         rm--;
00178                 while (data[rm] > val);
00179         
00180                 do 
00181                         lm++;
00182                 while(data[lm] < val);
00183 
00184                 if(lm < rm)
00185         {
00186                         Type temp = data[rm];
00187                         data[rm] = data[lm];
00188                         data[lm] = temp;
00189                         CoType coTemp = coData[rm];
00190                         coData[rm] = coData[lm];
00191                         coData[lm] = coTemp;
00192                 }
00193                 else 
00194                         return rm;
00195         }
00196 }


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