咕泡P5人工智能CV+NLP技術(shù)
Objective-C語言實(shí)現(xiàn):
- (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];
? ?}
標(biāo)簽: