咕泡P5人工智能CV+NLP技术
Objective-C语言实现:
- (void )fast:(NSArray *)array left:(int)left right:(int)right{
if (left >= right) {
return ;
}
NSMutableArray *tempArray = [NSMutableArray arrayWithArray:array];
int i = left;
int j = right;
int key = [tempArray[left] intValue];
while (i < j) {
while (i < j && [tempArray[j] intValue] >= key) {
j --;
}
tempArray[i] = tempArray[j];
while (i < j && [tempArray[i] intValue] <= key) {
i ++;
}
tempArray[j] = tempArray[i];
}
tempArray[i] = [NSNumber numberWithInt:key];
[self fast:tempArray left:left right:i - 1];
[self fast:tempArray left:i + 1 right:right];
}