本文共 577 字,大约阅读时间需要 1 分钟。
Objective-C?????????????
???????????????????????????????????????????Objective-C??????????????????
???????????????????
#import <Foundation/Foundation.h>
@interface LinearSearch : NSObject
(NSInteger)linearSearch:(NSArray *)array
{NSInteger target;NSInteger index = 0;for (id element in array) {if (element == target) {return index;}index++;}return -1;}
??????????????????????????????????????????????????????????????????????????????????-1?
?????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????
转载地址:http://rusfk.baihongyu.com/