Skip to content

Instantly share code, notes, and snippets.

@youweit youweit/gist:7306258
Last active Dec 27, 2015

What would you like to do?
Quick sort
//Call with [self quickSort:0 withHigh:[scanpleFileList count]-1];
-(void)quickSort:(int)low withHigh:(int)high;{
int i = low,j = high;
int pivot = [[[scanpleFileList objectAtIndex:(low+high)/2]time]intValue];
while(i <= j){
while([[[scanpleFileList objectAtIndex:i]time]intValue] < pivot) i++;
while([[[scanpleFileList objectAtIndex:j]time]intValue] > pivot) j--;
[scanpleFileList exchangeObjectAtIndex:i withObjectAtIndex:j];
if(low < j) [self quickSort:low withHigh:j];
if(i < high)[self quickSort:i withHigh:high];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.