├── README.md ├── 排序算法.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── Krystal.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Krystal.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── 排序算法 ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── 排序算法Tests ├── Info.plist └── ____Tests.m └── 排序算法UITests ├── Info.plist └── ____UITests.m /README.md: -------------------------------------------------------------------------------- 1 | # SortingAlgorithm 2 | 3 | 常用算法:冒泡排序 快速排序 插入排序 二分插入排序 二分查找排序 (Object-C) 4 | -------------------------------------------------------------------------------- /排序算法.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B226053C205A0998004CB825 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B226053B205A0998004CB825 /* AppDelegate.m */; }; 11 | B226053F205A0998004CB825 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B226053E205A0998004CB825 /* ViewController.m */; }; 12 | B2260542205A0998004CB825 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2260540205A0998004CB825 /* Main.storyboard */; }; 13 | B2260544205A0998004CB825 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2260543205A0998004CB825 /* Assets.xcassets */; }; 14 | B2260547205A0998004CB825 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2260545205A0998004CB825 /* LaunchScreen.storyboard */; }; 15 | B226054A205A0998004CB825 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B2260549205A0998004CB825 /* main.m */; }; 16 | B2260554205A0998004CB825 /* ____Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = B2260553205A0998004CB825 /* ____Tests.m */; }; 17 | B226055F205A0998004CB825 /* ____UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = B226055E205A0998004CB825 /* ____UITests.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | B2260550205A0998004CB825 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = B226052F205A0998004CB825 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = B2260536205A0998004CB825; 26 | remoteInfo = "排序算法"; 27 | }; 28 | B226055B205A0998004CB825 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = B226052F205A0998004CB825 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = B2260536205A0998004CB825; 33 | remoteInfo = "排序算法"; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | B2260537205A0998004CB825 /* 排序算法.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "排序算法.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | B226053A205A0998004CB825 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 40 | B226053B205A0998004CB825 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 41 | B226053D205A0998004CB825 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 42 | B226053E205A0998004CB825 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 43 | B2260541205A0998004CB825 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | B2260543205A0998004CB825 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | B2260546205A0998004CB825 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | B2260548205A0998004CB825 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | B2260549205A0998004CB825 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | B226054F205A0998004CB825 /* 排序算法Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "排序算法Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | B2260553205A0998004CB825 /* ____Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "____Tests.m"; sourceTree = ""; }; 50 | B2260555205A0998004CB825 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | B226055A205A0998004CB825 /* 排序算法UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "排序算法UITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | B226055E205A0998004CB825 /* ____UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "____UITests.m"; sourceTree = ""; }; 53 | B2260560205A0998004CB825 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | B2260534205A0998004CB825 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | B226054C205A0998004CB825 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | B2260557205A0998004CB825 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | B226052E205A0998004CB825 = { 82 | isa = PBXGroup; 83 | children = ( 84 | B2260539205A0998004CB825 /* 排序算法 */, 85 | B2260552205A0998004CB825 /* 排序算法Tests */, 86 | B226055D205A0998004CB825 /* 排序算法UITests */, 87 | B2260538205A0998004CB825 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | B2260538205A0998004CB825 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | B2260537205A0998004CB825 /* 排序算法.app */, 95 | B226054F205A0998004CB825 /* 排序算法Tests.xctest */, 96 | B226055A205A0998004CB825 /* 排序算法UITests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | B2260539205A0998004CB825 /* 排序算法 */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | B226053A205A0998004CB825 /* AppDelegate.h */, 105 | B226053B205A0998004CB825 /* AppDelegate.m */, 106 | B226053D205A0998004CB825 /* ViewController.h */, 107 | B226053E205A0998004CB825 /* ViewController.m */, 108 | B2260540205A0998004CB825 /* Main.storyboard */, 109 | B2260543205A0998004CB825 /* Assets.xcassets */, 110 | B2260545205A0998004CB825 /* LaunchScreen.storyboard */, 111 | B2260548205A0998004CB825 /* Info.plist */, 112 | B2260549205A0998004CB825 /* main.m */, 113 | ); 114 | path = "排序算法"; 115 | sourceTree = ""; 116 | }; 117 | B2260552205A0998004CB825 /* 排序算法Tests */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | B2260553205A0998004CB825 /* ____Tests.m */, 121 | B2260555205A0998004CB825 /* Info.plist */, 122 | ); 123 | path = "排序算法Tests"; 124 | sourceTree = ""; 125 | }; 126 | B226055D205A0998004CB825 /* 排序算法UITests */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | B226055E205A0998004CB825 /* ____UITests.m */, 130 | B2260560205A0998004CB825 /* Info.plist */, 131 | ); 132 | path = "排序算法UITests"; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXNativeTarget section */ 138 | B2260536205A0998004CB825 /* 排序算法 */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = B2260563205A0998004CB825 /* Build configuration list for PBXNativeTarget "排序算法" */; 141 | buildPhases = ( 142 | B2260533205A0998004CB825 /* Sources */, 143 | B2260534205A0998004CB825 /* Frameworks */, 144 | B2260535205A0998004CB825 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = "排序算法"; 151 | productName = "排序算法"; 152 | productReference = B2260537205A0998004CB825 /* 排序算法.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | B226054E205A0998004CB825 /* 排序算法Tests */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = B2260566205A0998004CB825 /* Build configuration list for PBXNativeTarget "排序算法Tests" */; 158 | buildPhases = ( 159 | B226054B205A0998004CB825 /* Sources */, 160 | B226054C205A0998004CB825 /* Frameworks */, 161 | B226054D205A0998004CB825 /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | B2260551205A0998004CB825 /* PBXTargetDependency */, 167 | ); 168 | name = "排序算法Tests"; 169 | productName = "排序算法Tests"; 170 | productReference = B226054F205A0998004CB825 /* 排序算法Tests.xctest */; 171 | productType = "com.apple.product-type.bundle.unit-test"; 172 | }; 173 | B2260559205A0998004CB825 /* 排序算法UITests */ = { 174 | isa = PBXNativeTarget; 175 | buildConfigurationList = B2260569205A0998004CB825 /* Build configuration list for PBXNativeTarget "排序算法UITests" */; 176 | buildPhases = ( 177 | B2260556205A0998004CB825 /* Sources */, 178 | B2260557205A0998004CB825 /* Frameworks */, 179 | B2260558205A0998004CB825 /* Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | B226055C205A0998004CB825 /* PBXTargetDependency */, 185 | ); 186 | name = "排序算法UITests"; 187 | productName = "排序算法UITests"; 188 | productReference = B226055A205A0998004CB825 /* 排序算法UITests.xctest */; 189 | productType = "com.apple.product-type.bundle.ui-testing"; 190 | }; 191 | /* End PBXNativeTarget section */ 192 | 193 | /* Begin PBXProject section */ 194 | B226052F205A0998004CB825 /* Project object */ = { 195 | isa = PBXProject; 196 | attributes = { 197 | LastUpgradeCheck = 0920; 198 | ORGANIZATIONNAME = liaojingyu; 199 | TargetAttributes = { 200 | B2260536205A0998004CB825 = { 201 | CreatedOnToolsVersion = 9.2; 202 | ProvisioningStyle = Automatic; 203 | }; 204 | B226054E205A0998004CB825 = { 205 | CreatedOnToolsVersion = 9.2; 206 | ProvisioningStyle = Automatic; 207 | TestTargetID = B2260536205A0998004CB825; 208 | }; 209 | B2260559205A0998004CB825 = { 210 | CreatedOnToolsVersion = 9.2; 211 | ProvisioningStyle = Automatic; 212 | TestTargetID = B2260536205A0998004CB825; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = B2260532205A0998004CB825 /* Build configuration list for PBXProject "排序算法" */; 217 | compatibilityVersion = "Xcode 8.0"; 218 | developmentRegion = en; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | Base, 223 | ); 224 | mainGroup = B226052E205A0998004CB825; 225 | productRefGroup = B2260538205A0998004CB825 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | B2260536205A0998004CB825 /* 排序算法 */, 230 | B226054E205A0998004CB825 /* 排序算法Tests */, 231 | B2260559205A0998004CB825 /* 排序算法UITests */, 232 | ); 233 | }; 234 | /* End PBXProject section */ 235 | 236 | /* Begin PBXResourcesBuildPhase section */ 237 | B2260535205A0998004CB825 /* Resources */ = { 238 | isa = PBXResourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | B2260547205A0998004CB825 /* LaunchScreen.storyboard in Resources */, 242 | B2260544205A0998004CB825 /* Assets.xcassets in Resources */, 243 | B2260542205A0998004CB825 /* Main.storyboard in Resources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | B226054D205A0998004CB825 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | B2260558205A0998004CB825 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | /* End PBXResourcesBuildPhase section */ 262 | 263 | /* Begin PBXSourcesBuildPhase section */ 264 | B2260533205A0998004CB825 /* Sources */ = { 265 | isa = PBXSourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | B226053F205A0998004CB825 /* ViewController.m in Sources */, 269 | B226054A205A0998004CB825 /* main.m in Sources */, 270 | B226053C205A0998004CB825 /* AppDelegate.m in Sources */, 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | B226054B205A0998004CB825 /* Sources */ = { 275 | isa = PBXSourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | B2260554205A0998004CB825 /* ____Tests.m in Sources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | B2260556205A0998004CB825 /* Sources */ = { 283 | isa = PBXSourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | B226055F205A0998004CB825 /* ____UITests.m in Sources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | /* End PBXSourcesBuildPhase section */ 291 | 292 | /* Begin PBXTargetDependency section */ 293 | B2260551205A0998004CB825 /* PBXTargetDependency */ = { 294 | isa = PBXTargetDependency; 295 | target = B2260536205A0998004CB825 /* 排序算法 */; 296 | targetProxy = B2260550205A0998004CB825 /* PBXContainerItemProxy */; 297 | }; 298 | B226055C205A0998004CB825 /* PBXTargetDependency */ = { 299 | isa = PBXTargetDependency; 300 | target = B2260536205A0998004CB825 /* 排序算法 */; 301 | targetProxy = B226055B205A0998004CB825 /* PBXContainerItemProxy */; 302 | }; 303 | /* End PBXTargetDependency section */ 304 | 305 | /* Begin PBXVariantGroup section */ 306 | B2260540205A0998004CB825 /* Main.storyboard */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | B2260541205A0998004CB825 /* Base */, 310 | ); 311 | name = Main.storyboard; 312 | sourceTree = ""; 313 | }; 314 | B2260545205A0998004CB825 /* LaunchScreen.storyboard */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | B2260546205A0998004CB825 /* Base */, 318 | ); 319 | name = LaunchScreen.storyboard; 320 | sourceTree = ""; 321 | }; 322 | /* End PBXVariantGroup section */ 323 | 324 | /* Begin XCBuildConfiguration section */ 325 | B2260561205A0998004CB825 /* Debug */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_ANALYZER_NONNULL = YES; 330 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 336 | CLANG_WARN_BOOL_CONVERSION = YES; 337 | CLANG_WARN_COMMA = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 341 | CLANG_WARN_EMPTY_BODY = YES; 342 | CLANG_WARN_ENUM_CONVERSION = YES; 343 | CLANG_WARN_INFINITE_RECURSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 349 | CLANG_WARN_STRICT_PROTOTYPES = YES; 350 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 351 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 352 | CLANG_WARN_UNREACHABLE_CODE = YES; 353 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 354 | CODE_SIGN_IDENTITY = "iPhone Developer"; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = dwarf; 357 | ENABLE_STRICT_OBJC_MSGSEND = YES; 358 | ENABLE_TESTABILITY = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu11; 360 | GCC_DYNAMIC_NO_PIC = NO; 361 | GCC_NO_COMMON_BLOCKS = YES; 362 | GCC_OPTIMIZATION_LEVEL = 0; 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 374 | MTL_ENABLE_DEBUG_INFO = YES; 375 | ONLY_ACTIVE_ARCH = YES; 376 | SDKROOT = iphoneos; 377 | }; 378 | name = Debug; 379 | }; 380 | B2260562205A0998004CB825 /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_SEARCH_USER_PATHS = NO; 384 | CLANG_ANALYZER_NONNULL = YES; 385 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 386 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | CLANG_ENABLE_MODULES = YES; 389 | CLANG_ENABLE_OBJC_ARC = YES; 390 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 391 | CLANG_WARN_BOOL_CONVERSION = YES; 392 | CLANG_WARN_COMMA = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 395 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 396 | CLANG_WARN_EMPTY_BODY = YES; 397 | CLANG_WARN_ENUM_CONVERSION = YES; 398 | CLANG_WARN_INFINITE_RECURSION = YES; 399 | CLANG_WARN_INT_CONVERSION = YES; 400 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 401 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 402 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 403 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 404 | CLANG_WARN_STRICT_PROTOTYPES = YES; 405 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 406 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 407 | CLANG_WARN_UNREACHABLE_CODE = YES; 408 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 409 | CODE_SIGN_IDENTITY = "iPhone Developer"; 410 | COPY_PHASE_STRIP = NO; 411 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 412 | ENABLE_NS_ASSERTIONS = NO; 413 | ENABLE_STRICT_OBJC_MSGSEND = YES; 414 | GCC_C_LANGUAGE_STANDARD = gnu11; 415 | GCC_NO_COMMON_BLOCKS = YES; 416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 418 | GCC_WARN_UNDECLARED_SELECTOR = YES; 419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 420 | GCC_WARN_UNUSED_FUNCTION = YES; 421 | GCC_WARN_UNUSED_VARIABLE = YES; 422 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 423 | MTL_ENABLE_DEBUG_INFO = NO; 424 | SDKROOT = iphoneos; 425 | VALIDATE_PRODUCT = YES; 426 | }; 427 | name = Release; 428 | }; 429 | B2260564205A0998004CB825 /* Debug */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 433 | CODE_SIGN_STYLE = Automatic; 434 | INFOPLIST_FILE = "排序算法/Info.plist"; 435 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 436 | PRODUCT_BUNDLE_IDENTIFIER = "com.krystal.----"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | TARGETED_DEVICE_FAMILY = "1,2"; 439 | }; 440 | name = Debug; 441 | }; 442 | B2260565205A0998004CB825 /* Release */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 446 | CODE_SIGN_STYLE = Automatic; 447 | INFOPLIST_FILE = "排序算法/Info.plist"; 448 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 449 | PRODUCT_BUNDLE_IDENTIFIER = "com.krystal.----"; 450 | PRODUCT_NAME = "$(TARGET_NAME)"; 451 | TARGETED_DEVICE_FAMILY = "1,2"; 452 | }; 453 | name = Release; 454 | }; 455 | B2260567205A0998004CB825 /* Debug */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | BUNDLE_LOADER = "$(TEST_HOST)"; 459 | CODE_SIGN_STYLE = Automatic; 460 | INFOPLIST_FILE = "排序算法Tests/Info.plist"; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 462 | PRODUCT_BUNDLE_IDENTIFIER = "com.krystal.----Tests"; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | TARGETED_DEVICE_FAMILY = "1,2"; 465 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/排序算法.app/排序算法"; 466 | }; 467 | name = Debug; 468 | }; 469 | B2260568205A0998004CB825 /* Release */ = { 470 | isa = XCBuildConfiguration; 471 | buildSettings = { 472 | BUNDLE_LOADER = "$(TEST_HOST)"; 473 | CODE_SIGN_STYLE = Automatic; 474 | INFOPLIST_FILE = "排序算法Tests/Info.plist"; 475 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 476 | PRODUCT_BUNDLE_IDENTIFIER = "com.krystal.----Tests"; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TARGETED_DEVICE_FAMILY = "1,2"; 479 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/排序算法.app/排序算法"; 480 | }; 481 | name = Release; 482 | }; 483 | B226056A205A0998004CB825 /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | buildSettings = { 486 | CODE_SIGN_STYLE = Automatic; 487 | INFOPLIST_FILE = "排序算法UITests/Info.plist"; 488 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 489 | PRODUCT_BUNDLE_IDENTIFIER = "com.krystal.----UITests"; 490 | PRODUCT_NAME = "$(TARGET_NAME)"; 491 | TARGETED_DEVICE_FAMILY = "1,2"; 492 | TEST_TARGET_NAME = "排序算法"; 493 | }; 494 | name = Debug; 495 | }; 496 | B226056B205A0998004CB825 /* Release */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | CODE_SIGN_STYLE = Automatic; 500 | INFOPLIST_FILE = "排序算法UITests/Info.plist"; 501 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 502 | PRODUCT_BUNDLE_IDENTIFIER = "com.krystal.----UITests"; 503 | PRODUCT_NAME = "$(TARGET_NAME)"; 504 | TARGETED_DEVICE_FAMILY = "1,2"; 505 | TEST_TARGET_NAME = "排序算法"; 506 | }; 507 | name = Release; 508 | }; 509 | /* End XCBuildConfiguration section */ 510 | 511 | /* Begin XCConfigurationList section */ 512 | B2260532205A0998004CB825 /* Build configuration list for PBXProject "排序算法" */ = { 513 | isa = XCConfigurationList; 514 | buildConfigurations = ( 515 | B2260561205A0998004CB825 /* Debug */, 516 | B2260562205A0998004CB825 /* Release */, 517 | ); 518 | defaultConfigurationIsVisible = 0; 519 | defaultConfigurationName = Release; 520 | }; 521 | B2260563205A0998004CB825 /* Build configuration list for PBXNativeTarget "排序算法" */ = { 522 | isa = XCConfigurationList; 523 | buildConfigurations = ( 524 | B2260564205A0998004CB825 /* Debug */, 525 | B2260565205A0998004CB825 /* Release */, 526 | ); 527 | defaultConfigurationIsVisible = 0; 528 | defaultConfigurationName = Release; 529 | }; 530 | B2260566205A0998004CB825 /* Build configuration list for PBXNativeTarget "排序算法Tests" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | B2260567205A0998004CB825 /* Debug */, 534 | B2260568205A0998004CB825 /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | defaultConfigurationName = Release; 538 | }; 539 | B2260569205A0998004CB825 /* Build configuration list for PBXNativeTarget "排序算法UITests" */ = { 540 | isa = XCConfigurationList; 541 | buildConfigurations = ( 542 | B226056A205A0998004CB825 /* Debug */, 543 | B226056B205A0998004CB825 /* Release */, 544 | ); 545 | defaultConfigurationIsVisible = 0; 546 | defaultConfigurationName = Release; 547 | }; 548 | /* End XCConfigurationList section */ 549 | }; 550 | rootObject = B226052F205A0998004CB825 /* Project object */; 551 | } 552 | -------------------------------------------------------------------------------- /排序算法.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /排序算法.xcodeproj/project.xcworkspace/xcuserdata/Krystal.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youaremyall/SortingAlgorithm/fa1512010861080272c4ff48b416af6d45c7f8e8/排序算法.xcodeproj/project.xcworkspace/xcuserdata/Krystal.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /排序算法.xcodeproj/xcuserdata/Krystal.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 排序算法.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /排序算法/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // 排序算法 4 | // 5 | // Created by 廖靖宇 on 2018/3/15. 6 | // Copyright © 2018年 liaojingyu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /排序算法/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // 排序算法 4 | // 5 | // Created by 廖靖宇 on 2018/3/15. 6 | // Copyright © 2018年 liaojingyu. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /排序算法/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /排序算法/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /排序算法/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /排序算法/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /排序算法/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // 排序算法 4 | // 5 | // Created by 廖靖宇 on 2018/3/15. 6 | // Copyright © 2018年 liaojingyu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /排序算法/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // 排序算法 4 | // 5 | // Created by 廖靖宇 on 2018/3/15. 6 | // Copyright © 2018年 liaojingyu. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | //#import "ChessBoardModel.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | NSMutableArray *marr = [@[@4,@11,@9,@3,@14,@22,@2,@3,@100,@19,@1,@21] mutableCopy]; 22 | NSLog(@"初始:%@", [self stringFromArray:marr head:0 tail:marr.count-1]); 23 | 24 | // [self maopaoDemo:marr]; 25 | // [self fastDemo:marr head:0 tail:marr.count-1]; 26 | // [self directInsetDemo:marr]; 27 | // [self dichotomyInsetDemo:marr]; 28 | NSLog(@"最终:%@", [self stringFromArray:marr head:0 tail:marr.count-1]); 29 | } 30 | #pragma mark - 冒泡排序 31 | - (void)maopaoDemo:(NSMutableArray *)marr{ 32 | if (marr.count <= 1) {return;} 33 | 34 | for (int i=0; i [marr[j] integerValue]) { 37 | NSNumber *t = marr[j]; 38 | marr[j] = marr[i]; 39 | marr[i] = t; 40 | } 41 | } 42 | } 43 | NSLog(@"marr:%@",marr); 44 | } 45 | #pragma mark - 快速排序 46 | - (void)fastDemo:(NSMutableArray *)marr head:(NSInteger)head tail:(NSInteger)tail{ 47 | if (marr.count <= 1) {return;} 48 | if (head<0 || tail>marr.count-1) {return;} 49 | if (head>=tail) {return;} 50 | 51 | NSInteger low = head; 52 | NSInteger hight = tail; 53 | BOOL kRight = NO; // 比较的基数是否已交换到右边 54 | while (1) { 55 | if (low == hight){ 56 | if (low-head>0) { 57 | // 左边递归 58 | NSLog(@"左边递归:%@",[self stringFromArray:marr head:head tail:low-1]); 59 | [self fastDemo:marr head:head tail:low-1]; 60 | } 61 | if (tail-hight>0) { 62 | // 右边递归 63 | NSLog(@"右边递归:%@",[self stringFromArray:marr head:hight+1 tail:tail]); 64 | [self fastDemo:marr head:hight+1 tail:tail]; 65 | } 66 | break; 67 | } 68 | 69 | // 交换 70 | if (marr[low] > marr[hight]) { 71 | id t = marr[hight]; 72 | marr[hight] = marr[low]; 73 | marr[low] = t; 74 | kRight = !kRight; 75 | NSLog(@"交换后:%@",[self stringFromArray:marr head:head tail:tail]); 76 | } 77 | kRight ? low++ : hight--; 78 | } 79 | } 80 | - (NSString *)stringFromArray:(NSArray *)arr head:(NSInteger)head tail:(NSInteger)tail{ 81 | NSMutableString *mstr = [@"" mutableCopy]; 82 | for (NSInteger i=head; i<=tail; i++) { 83 | [mstr appendString:[NSString stringWithFormat:@"%@,",arr[i]]]; 84 | } 85 | return [mstr copy]; 86 | } 87 | #pragma mark - 插入排序 88 | // 直接插入排序 89 | - (void)directInsetDemo:(NSMutableArray *)marr{ 90 | if (marr.count <= 1) {return;} 91 | 92 | for (int i=1; i0; j--) { 99 | if (marr[j] > marr[j-1]) { 100 | break; 101 | } 102 | marr[j] = marr[j-1]; 103 | marr[j-1] = inset; 104 | } 105 | } 106 | } 107 | } 108 | // 二分插入排序 109 | - (void)dichotomyInsetDemo:(NSMutableArray *)marr{ 110 | if (marr.count <= 1) {return;} 111 | 112 | for (int i=1; iinsetIndex; j--) { 121 | marr[j] = marr[j-1]; 122 | } 123 | marr[insetIndex] = inset; 124 | NSLog(@"替换后的数组:%@", [self stringFromArray:marr head:0 tail:marr.count-1]); 125 | } 126 | } 127 | } 128 | // 二分查找法 129 | static const NSInteger kErrorIndex = -99; // 查找错误,比如不满足查找条件时,返回此值 130 | - (NSInteger)insetIndexOfObject:(id)obj inArray:(NSArray *)arr head:(NSInteger)head fail:(NSInteger)fail{ 131 | NSInteger errorIndex = kErrorIndex; 132 | if (!obj) {return errorIndex;} 133 | if (head < 0 || fail > arr.count-1) {return errorIndex;} 134 | if (head > fail) {return errorIndex;} 135 | 136 | NSInteger insetIndex = errorIndex; 137 | NSInteger centerIndex = head + (fail - head)/2; 138 | if (arr[centerIndex] == obj) { 139 | insetIndex = centerIndex+1; 140 | NSLog(@"--中心值相等center:%ld insetIndex:%ld", centerIndex, insetIndex); 141 | }else if (arr[centerIndex] > obj) { 142 | if (centerIndex <= head){ 143 | // 最小 144 | insetIndex = centerIndex; 145 | NSLog(@"--比最左还小 insetIndex:%ld", insetIndex); 146 | }else{ 147 | NSLog(@"--head:%ld fail:%ld center:%ld 左边二分查找obj:%@ arr:%@", head, fail, centerIndex, obj , [self stringFromArray:arr head:head tail:centerIndex]); 148 | insetIndex = [self insetIndexOfObject:obj inArray:arr head:head fail:centerIndex]; 149 | } 150 | }else { 151 | if (centerIndex >= fail) { 152 | // 最大 153 | insetIndex = centerIndex+1; 154 | NSLog(@"--比最右还大 insetIndex:%ld", insetIndex); 155 | }else{ 156 | NSLog(@"--head:%ld fail:%ld center:%ld 右边二分查找obj:%@ arr:%@", head, fail, centerIndex, obj , [self stringFromArray:arr head:centerIndex+1 tail:fail]); 157 | insetIndex = [self insetIndexOfObject:obj inArray:arr head:centerIndex+1 fail:fail]; 158 | } 159 | } 160 | return insetIndex; 161 | } 162 | 163 | @end 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /排序算法/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 排序算法 4 | // 5 | // Created by 廖靖宇 on 2018/3/15. 6 | // Copyright © 2018年 liaojingyu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /排序算法Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /排序算法Tests/____Tests.m: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | #import 4 | 5 | @interface ___FILEBASENAMEASIDENTIFIER___ : XCTestCase 6 | 7 | @end 8 | 9 | @implementation ___FILEBASENAMEASIDENTIFIER___ 10 | 11 | - (void)setUp { 12 | [super setUp]; 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | } 15 | 16 | - (void)tearDown { 17 | // Put teardown code here. This method is called after the invocation of each test method in the class. 18 | [super tearDown]; 19 | } 20 | 21 | - (void)testExample { 22 | // This is an example of a functional test case. 23 | // Use XCTAssert and related functions to verify your tests produce the correct results. 24 | } 25 | 26 | - (void)testPerformanceExample { 27 | // This is an example of a performance test case. 28 | [self measureBlock:^{ 29 | // Put the code you want to measure the time of here. 30 | }]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /排序算法UITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /排序算法UITests/____UITests.m: -------------------------------------------------------------------------------- 1 | //___FILEHEADER___ 2 | 3 | #import 4 | 5 | @interface ___FILEBASENAMEASIDENTIFIER___ : XCTestCase 6 | 7 | @end 8 | 9 | @implementation ___FILEBASENAMEASIDENTIFIER___ 10 | 11 | - (void)setUp { 12 | [super setUp]; 13 | 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | self.continueAfterFailure = NO; 18 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 19 | [[[XCUIApplication alloc] init] launch]; 20 | 21 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 22 | } 23 | 24 | - (void)tearDown { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample { 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | @end 35 | --------------------------------------------------------------------------------