最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

九章算法人工智能集訓營2022

2022-09-26 22:49 作者:綠兔子2  | 我要投稿
  • Objective-C語言實現(xiàn):

- (NSArray *)mergeWithArray:(NSArray *)sourceArray ? ? ? ? ? ?startIndex:(NSInteger)startIndex ? ? ? ? ? ? ?midIndex:(NSInteger)midIndex ? ? ? ? ? ? ?endIndex:(NSInteger)endIndex{ ? ?NSMutableArray *sourceMutableArray = [NSMutableArray arrayWithArray:sourceArray]; ? ?NSMutableArray *tempMutableArray = [[NSMutableArray alloc] init]; ? ? ? ?NSInteger i = startIndex; ? ?NSInteger j = midIndex + 1; ? ?NSInteger k = startIndex; ? ?while (i != midIndex && j != endIndex){ ? ? ? ?if (sourceMutableArray[i] > sourceMutableArray[j]) { ? ? ? ? ? ?//tempMutableArray[k] = sourceMutableArray[j]; ? ? ? ? ? ?[tempMutableArray replaceObjectAtIndex:k withObject:sourceMutableArray[j]]; ? ? ? ? ? ?k ++; ? ? ? ? ? ?j ++; ? ? ? ?}else{ ? ? ? ? ? ?//tempMutableArray[k] = sourceMutableArray[i]; ? ? ? ? ? ?[tempMutableArray replaceObjectAtIndex:k withObject:sourceMutableArray[i]]; ? ? ? ? ? ?k ++; ? ? ? ? ? ?i ++; ? ? ? ?} ? ?} ? ?while (i != midIndex + 1) { ? ? ? ?[tempMutableArray replaceObjectAtIndex:k withObject:sourceMutableArray[i]]; ? ? ? ?k ++; ? ? ? ?i ++; ? ?} ? ?while (j != endIndex + 1) { ? ? ? ?[tempMutableArray replaceObjectAtIndex:k withObject:sourceMutableArray[j]]; ? ? ? ?k ++; ? ? ? ?j ++; ? ?} ? ?for (i = startIndex; i < endIndex; i ++) { ? ? ? ?[sourceMutableArray replaceObjectAtIndex:i withObject:tempMutableArray[i]]; ? ?} ? ?return sourceMutableArray;}- (NSArray *)mergeSortWithArray:(NSArray *)sourceArray ? ? ? ? ? ? ? ? ? ? startIndex:(NSInteger)startIndex ? ? ? ? ? ? ? ? ? ? ? endIndex:(NSInteger)endIndex{ ? ?if (startIndex < endIndex) { ? ? ? ?NSInteger midIndex = (startIndex + endIndex)/2; ? ? ? ?NSArray *tempArray = ?[self mergeSortWithArray:sourceArray ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?startIndex:startIndex ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?endIndex:endIndex]; ? ? ? ?NSArray *tempArray2 = [self mergeSortWithArray:tempArray ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?startIndex:midIndex + 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?endIndex:endIndex]; ? ? ? ?return [self mergeWithArray:tempArray2 ? ? ? ? ? ? ? ? ? ? ? ? startIndex:startIndex ? ? ? ? ? ? ? ? ? ? ? ? ? midIndex:midIndex ? ? ? ? ? ? ? ? ? ? ? ? ? endIndex:endIndex]; ? ? ? ? ?} ? ?return nil;}



九章算法人工智能集訓營2022的評論 (共 條)

分享到微博請遵守國家法律
旅游| 岐山县| 福州市| 新郑市| 禹州市| 策勒县| 定西市| 海阳市| 海南省| 观塘区| 桂东县| 临江市| 嘉荫县| 溧水县| 芜湖市| 崇仁县| 太康县| 托克逊县| 崇礼县| 奉贤区| 大洼县| 阜城县| 中宁县| 邯郸市| 桂林市| 兴山县| 浙江省| 获嘉县| 明水县| 罗甸县| 临泉县| 视频| 罗城| 娱乐| 长沙市| 广河县| 长垣县| 贵州省| 常山县| 勐海县| 镶黄旗|