队列 - 解密美女QQ号

FIFO

//
//  main.m
//  Algorithms
//
//  Created by yuki on 2017/3/25.
//  Copyright © 2017年 kang.yu.sh. All rights reserved.
//

#import 
static NSMutableArray *list;

void sumalute(){
    NSInteger head = 0;
    NSInteger tail = list.count - 1 ;
    NSMutableArray *SoList = [list mutableCopy];
    NSMutableArray *QQList = [NSMutableArray array];
    while (head < tail) {
        [QQList addObject:SoList[head]];
        head ++;
        tail++;
        [SoList addObject:SoList[head]];
        head++;
    }
    [QQList addObject:SoList[head]];
    NSLog(@"QQ>>: %@",QQList);
}

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        list = [NSMutableArray arrayWithCapacity:100];
        [list addObjectsFromArray:[NSArray arrayWithObjects:@"6",@"3",@"1",@"7",@"5",@"8",@"9",@"2",@"4", nil]];
        
        sumalute();
        
        NSLog(@"%@",list);
        
    }
    return 0;
}



你可能感兴趣的:(队列 - 解密美女QQ号)