Skip to content

Commit 5ceaa78

Browse files
committed
selection sort
1 parent b3c32cc commit 5ceaa78

File tree

13 files changed

+813
-0
lines changed

13 files changed

+813
-0
lines changed
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
96735E321CD34D6300A4E619 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 96735E311CD34D6300A4E619 /* main.c */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXCopyFilesBuildPhase section */
14+
96735E2C1CD34D6300A4E619 /* CopyFiles */ = {
15+
isa = PBXCopyFilesBuildPhase;
16+
buildActionMask = 2147483647;
17+
dstPath = /usr/share/man/man1/;
18+
dstSubfolderSpec = 0;
19+
files = (
20+
);
21+
runOnlyForDeploymentPostprocessing = 1;
22+
};
23+
/* End PBXCopyFilesBuildPhase section */
24+
25+
/* Begin PBXFileReference section */
26+
96735E2E1CD34D6300A4E619 /* quick_sort */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = quick_sort; sourceTree = BUILT_PRODUCTS_DIR; };
27+
96735E311CD34D6300A4E619 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
28+
/* End PBXFileReference section */
29+
30+
/* Begin PBXFrameworksBuildPhase section */
31+
96735E2B1CD34D6300A4E619 /* Frameworks */ = {
32+
isa = PBXFrameworksBuildPhase;
33+
buildActionMask = 2147483647;
34+
files = (
35+
);
36+
runOnlyForDeploymentPostprocessing = 0;
37+
};
38+
/* End PBXFrameworksBuildPhase section */
39+
40+
/* Begin PBXGroup section */
41+
96735E251CD34D6300A4E619 = {
42+
isa = PBXGroup;
43+
children = (
44+
96735E301CD34D6300A4E619 /* quick_sort */,
45+
96735E2F1CD34D6300A4E619 /* Products */,
46+
);
47+
sourceTree = "<group>";
48+
};
49+
96735E2F1CD34D6300A4E619 /* Products */ = {
50+
isa = PBXGroup;
51+
children = (
52+
96735E2E1CD34D6300A4E619 /* quick_sort */,
53+
);
54+
name = Products;
55+
sourceTree = "<group>";
56+
};
57+
96735E301CD34D6300A4E619 /* quick_sort */ = {
58+
isa = PBXGroup;
59+
children = (
60+
96735E311CD34D6300A4E619 /* main.c */,
61+
);
62+
path = quick_sort;
63+
sourceTree = "<group>";
64+
};
65+
/* End PBXGroup section */
66+
67+
/* Begin PBXNativeTarget section */
68+
96735E2D1CD34D6300A4E619 /* quick_sort */ = {
69+
isa = PBXNativeTarget;
70+
buildConfigurationList = 96735E351CD34D6300A4E619 /* Build configuration list for PBXNativeTarget "quick_sort" */;
71+
buildPhases = (
72+
96735E2A1CD34D6300A4E619 /* Sources */,
73+
96735E2B1CD34D6300A4E619 /* Frameworks */,
74+
96735E2C1CD34D6300A4E619 /* CopyFiles */,
75+
);
76+
buildRules = (
77+
);
78+
dependencies = (
79+
);
80+
name = quick_sort;
81+
productName = quick_sort;
82+
productReference = 96735E2E1CD34D6300A4E619 /* quick_sort */;
83+
productType = "com.apple.product-type.tool";
84+
};
85+
/* End PBXNativeTarget section */
86+
87+
/* Begin PBXProject section */
88+
96735E261CD34D6300A4E619 /* Project object */ = {
89+
isa = PBXProject;
90+
attributes = {
91+
LastUpgradeCheck = 0730;
92+
ORGANIZATIONNAME = "___spike___";
93+
TargetAttributes = {
94+
96735E2D1CD34D6300A4E619 = {
95+
CreatedOnToolsVersion = 7.3;
96+
};
97+
};
98+
};
99+
buildConfigurationList = 96735E291CD34D6300A4E619 /* Build configuration list for PBXProject "quick_sort" */;
100+
compatibilityVersion = "Xcode 3.2";
101+
developmentRegion = English;
102+
hasScannedForEncodings = 0;
103+
knownRegions = (
104+
en,
105+
);
106+
mainGroup = 96735E251CD34D6300A4E619;
107+
productRefGroup = 96735E2F1CD34D6300A4E619 /* Products */;
108+
projectDirPath = "";
109+
projectRoot = "";
110+
targets = (
111+
96735E2D1CD34D6300A4E619 /* quick_sort */,
112+
);
113+
};
114+
/* End PBXProject section */
115+
116+
/* Begin PBXSourcesBuildPhase section */
117+
96735E2A1CD34D6300A4E619 /* Sources */ = {
118+
isa = PBXSourcesBuildPhase;
119+
buildActionMask = 2147483647;
120+
files = (
121+
96735E321CD34D6300A4E619 /* main.c in Sources */,
122+
);
123+
runOnlyForDeploymentPostprocessing = 0;
124+
};
125+
/* End PBXSourcesBuildPhase section */
126+
127+
/* Begin XCBuildConfiguration section */
128+
96735E331CD34D6300A4E619 /* Debug */ = {
129+
isa = XCBuildConfiguration;
130+
buildSettings = {
131+
ALWAYS_SEARCH_USER_PATHS = NO;
132+
CLANG_ANALYZER_NONNULL = YES;
133+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
134+
CLANG_CXX_LIBRARY = "libc++";
135+
CLANG_ENABLE_MODULES = YES;
136+
CLANG_ENABLE_OBJC_ARC = YES;
137+
CLANG_WARN_BOOL_CONVERSION = YES;
138+
CLANG_WARN_CONSTANT_CONVERSION = YES;
139+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
140+
CLANG_WARN_EMPTY_BODY = YES;
141+
CLANG_WARN_ENUM_CONVERSION = YES;
142+
CLANG_WARN_INT_CONVERSION = YES;
143+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
144+
CLANG_WARN_UNREACHABLE_CODE = YES;
145+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
146+
CODE_SIGN_IDENTITY = "-";
147+
COPY_PHASE_STRIP = NO;
148+
DEBUG_INFORMATION_FORMAT = dwarf;
149+
ENABLE_STRICT_OBJC_MSGSEND = YES;
150+
ENABLE_TESTABILITY = YES;
151+
GCC_C_LANGUAGE_STANDARD = gnu99;
152+
GCC_DYNAMIC_NO_PIC = NO;
153+
GCC_NO_COMMON_BLOCKS = YES;
154+
GCC_OPTIMIZATION_LEVEL = 0;
155+
GCC_PREPROCESSOR_DEFINITIONS = (
156+
"DEBUG=1",
157+
"$(inherited)",
158+
);
159+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
160+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
161+
GCC_WARN_UNDECLARED_SELECTOR = YES;
162+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
163+
GCC_WARN_UNUSED_FUNCTION = YES;
164+
GCC_WARN_UNUSED_VARIABLE = YES;
165+
MACOSX_DEPLOYMENT_TARGET = 10.11;
166+
MTL_ENABLE_DEBUG_INFO = YES;
167+
ONLY_ACTIVE_ARCH = YES;
168+
SDKROOT = macosx;
169+
};
170+
name = Debug;
171+
};
172+
96735E341CD34D6300A4E619 /* Release */ = {
173+
isa = XCBuildConfiguration;
174+
buildSettings = {
175+
ALWAYS_SEARCH_USER_PATHS = NO;
176+
CLANG_ANALYZER_NONNULL = YES;
177+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
178+
CLANG_CXX_LIBRARY = "libc++";
179+
CLANG_ENABLE_MODULES = YES;
180+
CLANG_ENABLE_OBJC_ARC = YES;
181+
CLANG_WARN_BOOL_CONVERSION = YES;
182+
CLANG_WARN_CONSTANT_CONVERSION = YES;
183+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
184+
CLANG_WARN_EMPTY_BODY = YES;
185+
CLANG_WARN_ENUM_CONVERSION = YES;
186+
CLANG_WARN_INT_CONVERSION = YES;
187+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
188+
CLANG_WARN_UNREACHABLE_CODE = YES;
189+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
190+
CODE_SIGN_IDENTITY = "-";
191+
COPY_PHASE_STRIP = NO;
192+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
193+
ENABLE_NS_ASSERTIONS = NO;
194+
ENABLE_STRICT_OBJC_MSGSEND = YES;
195+
GCC_C_LANGUAGE_STANDARD = gnu99;
196+
GCC_NO_COMMON_BLOCKS = YES;
197+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
198+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
199+
GCC_WARN_UNDECLARED_SELECTOR = YES;
200+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
201+
GCC_WARN_UNUSED_FUNCTION = YES;
202+
GCC_WARN_UNUSED_VARIABLE = YES;
203+
MACOSX_DEPLOYMENT_TARGET = 10.11;
204+
MTL_ENABLE_DEBUG_INFO = NO;
205+
SDKROOT = macosx;
206+
};
207+
name = Release;
208+
};
209+
96735E361CD34D6300A4E619 /* Debug */ = {
210+
isa = XCBuildConfiguration;
211+
buildSettings = {
212+
PRODUCT_NAME = "$(TARGET_NAME)";
213+
};
214+
name = Debug;
215+
};
216+
96735E371CD34D6300A4E619 /* Release */ = {
217+
isa = XCBuildConfiguration;
218+
buildSettings = {
219+
PRODUCT_NAME = "$(TARGET_NAME)";
220+
};
221+
name = Release;
222+
};
223+
/* End XCBuildConfiguration section */
224+
225+
/* Begin XCConfigurationList section */
226+
96735E291CD34D6300A4E619 /* Build configuration list for PBXProject "quick_sort" */ = {
227+
isa = XCConfigurationList;
228+
buildConfigurations = (
229+
96735E331CD34D6300A4E619 /* Debug */,
230+
96735E341CD34D6300A4E619 /* Release */,
231+
);
232+
defaultConfigurationIsVisible = 0;
233+
defaultConfigurationName = Release;
234+
};
235+
96735E351CD34D6300A4E619 /* Build configuration list for PBXNativeTarget "quick_sort" */ = {
236+
isa = XCConfigurationList;
237+
buildConfigurations = (
238+
96735E361CD34D6300A4E619 /* Debug */,
239+
96735E371CD34D6300A4E619 /* Release */,
240+
);
241+
defaultConfigurationIsVisible = 0;
242+
};
243+
/* End XCConfigurationList section */
244+
};
245+
rootObject = 96735E261CD34D6300A4E619 /* Project object */;
246+
}

quick_sort/quick_sort.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0730"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "96735E2D1CD34D6300A4E619"
18+
BuildableName = "quick_sort"
19+
BlueprintName = "quick_sort"
20+
ReferencedContainer = "container:quick_sort.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
<MacroExpansion>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "96735E2D1CD34D6300A4E619"
36+
BuildableName = "quick_sort"
37+
BlueprintName = "quick_sort"
38+
ReferencedContainer = "container:quick_sort.xcodeproj">
39+
</BuildableReference>
40+
</MacroExpansion>
41+
<AdditionalOptions>
42+
</AdditionalOptions>
43+
</TestAction>
44+
<LaunchAction
45+
buildConfiguration = "Debug"
46+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
47+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
48+
launchStyle = "0"
49+
useCustomWorkingDirectory = "NO"
50+
ignoresPersistentStateOnLaunch = "NO"
51+
debugDocumentVersioning = "YES"
52+
debugServiceExtension = "internal"
53+
allowLocationSimulation = "YES">
54+
<BuildableProductRunnable
55+
runnableDebuggingMode = "0">
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "96735E2D1CD34D6300A4E619"
59+
BuildableName = "quick_sort"
60+
BlueprintName = "quick_sort"
61+
ReferencedContainer = "container:quick_sort.xcodeproj">
62+
</BuildableReference>
63+
</BuildableProductRunnable>
64+
<AdditionalOptions>
65+
</AdditionalOptions>
66+
</LaunchAction>
67+
<ProfileAction
68+
buildConfiguration = "Release"
69+
shouldUseLaunchSchemeArgsEnv = "YES"
70+
savedToolIdentifier = ""
71+
useCustomWorkingDirectory = "NO"
72+
debugDocumentVersioning = "YES">
73+
<BuildableProductRunnable
74+
runnableDebuggingMode = "0">
75+
<BuildableReference
76+
BuildableIdentifier = "primary"
77+
BlueprintIdentifier = "96735E2D1CD34D6300A4E619"
78+
BuildableName = "quick_sort"
79+
BlueprintName = "quick_sort"
80+
ReferencedContainer = "container:quick_sort.xcodeproj">
81+
</BuildableReference>
82+
</BuildableProductRunnable>
83+
</ProfileAction>
84+
<AnalyzeAction
85+
buildConfiguration = "Debug">
86+
</AnalyzeAction>
87+
<ArchiveAction
88+
buildConfiguration = "Release"
89+
revealArchiveInOrganizer = "YES">
90+
</ArchiveAction>
91+
</Scheme>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>quick_sort.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>96735E2D1CD34D6300A4E619</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
</dict>
21+
</dict>
22+
</plist>

quick_sort/quick_sort/main.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// main.c
3+
// quick_sort
4+
//
5+
// Created by spike on 16/4/29.
6+
// Copyright © 2016年 ___spike___. All rights reserved.
7+
//
8+
9+
#include <stdio.h>
10+
int Partition(int *A,int start, int end){
11+
int pivot = A[end];
12+
int partitionIndex = start;// set partition index as start initially
13+
for(int i = start; i < end; i++){
14+
if (A[i] <= pivot){
15+
swap(A[i],A[partitionIndex]);
16+
}
17+
}
18+
}
19+
20+
int main(int argc, const char * argv[]) {
21+
// insert code here...
22+
printf("Hello, World!\n");
23+
return 0;
24+
}

0 commit comments

Comments
 (0)