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

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

Note:
right is inclusive

Definition at line 103 of file QuickSort.h.

Referenced by QuickSortDesc().

00104 {
00105         Type val = data[left];
00106         int lm = left-1;
00107         int rm = right+1;
00108         for(;;)
00109     {
00110                 do
00111                         rm--;
00112                 while (data[rm] < val);
00113         
00114                 do 
00115                         lm++;
00116                 while(data[lm] > val);
00117 
00118                 if(lm < rm)
00119         {
00120                         Type tempr = data[rm];
00121                         data[rm] = data[lm];
00122                         data[lm] = tempr;
00123                 }
00124                 else 
00125                         return rm;
00126         }
00127 }


Generated on Fri Mar 19 11:39:11 2010 for ImpalaSrc by  doxygen 1.5.1