欢迎光临散文网 会员登陆 & 注册

李振良Go/Golang DevOps运维开发实战集训营

2022-09-29 21:37 作者:抽抽一生恋  | 我要投稿
  • OC语言实现:

- (NSArray *)selectAlgorithm:(NSArray *)array{    NSMutableArray *tempArray = [NSMutableArray arrayWithArray:array];    NSInteger count = tempArray.count;    int index;    for (int i = 0; i < count - 1; i ++) {      index = i;      for (int j = i + 1; j < count; j ++) {          if (tempArray[index] > tempArray[j]) {              index = j;      }    }        if (index != i) {              id temp = tempArray[i];              [tempArray replaceObjectAtIndex:i withObject:tempArray[index]];              [tempArray replaceObjectAtIndex:index withObject:temp];      }    }  return tempArray;}


 

李振良Go/Golang DevOps运维开发实战集训营的评论 (共 条)

分享到微博请遵守国家法律