Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

quick sort

  • Loading branch information...
commit edf693bc879885a319f9cfa6d137e340d6d85f97 1 parent ba87285
Fan Yu authored
View
BIN  C_Test/C_Test.sdf
Binary file not shown
View
BIN  C_Test/C_Test.suo
Binary file not shown
View
BIN  C_Test/C_Test/Debug/CL.read.1.tlog
Binary file not shown
View
BIN  C_Test/C_Test/Debug/CL.write.1.tlog
Binary file not shown
View
14 C_Test/C_Test/Debug/C_Test.Build.CppClean.log
@@ -1,16 +1,28 @@
-F:\MyGit\C\C_Test\C_Test\Debug\C_Test.exe.embed.manifest
+F:\MYGIT\C\C_TEST\C_TEST\DEBUG\C_TEST.EXE.EMBED.MANIFEST
F:\MYGIT\C\C_TEST\C_TEST\DEBUG\C_TEST.EXE.EMBED.MANIFEST.RES
F:\MyGit\C\C_Test\C_Test\Debug\C_Test.exe.intermediate.manifest
F:\MyGit\C\C_Test\C_Test\Debug\C_Test_manifest.rc
F:\MyGit\C\C_Test\C_Test\Debug\cl.command.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\CL.read.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\CL.write.1.tlog
+F:\MYGIT\C\C_TEST\C_TEST\DEBUG\KMP.OBJ
+F:\MyGit\C\C_Test\C_Test\Debug\link.4776.read.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\link.4776.write.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\link.4776-cvtres.read.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\link.4776-cvtres.write.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\link.5392.read.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\link.5392.write.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\link.5392-cvtres.read.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\link.5392-cvtres.write.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\link.command.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\link.read.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\link.write.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\link-cvtres.read.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\link-cvtres.write.1.tlog
F:\MYGIT\C\C_TEST\C_TEST\DEBUG\MAIN.OBJ
+F:\MyGit\C\C_Test\C_Test\Debug\mt.command.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\mt.read.1.tlog
+F:\MyGit\C\C_Test\C_Test\Debug\mt.write.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\rc.command.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\rc.read.1.tlog
F:\MyGit\C\C_Test\C_Test\Debug\rc.write.1.tlog
View
16 C_Test/C_Test/Debug/C_Test.log
@@ -1,19 +1,17 @@
-Build started 2012/6/12 21:47:47.
+Build started 2012/6/14 0:18:00.
1>Project "F:\MyGit\C\C_Test\C_Test\C_Test.vcxproj" on node 2 (build target(s)).
1>InitializeBuildStatus:
Creating "Debug\C_Test.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
- D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TC /analyze- /errorReport:prompt KMP.c main.c Sorts.c
- Sorts.c
+ D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TC /analyze- /errorReport:prompt main.c
main.c
- 1>f:\mygit\c\c_test\c_test\main.c(29): warning C4013: 'getche' undefined; assuming extern returning int
+ 1>f:\mygit\c\c_test\c_test\main.c(30): warning C4013: 'getche' undefined; assuming extern returning int
1>f:\mygit\c\c_test\c_test\main.c(16): warning C4101: 'p' : unreferenced local variable
1>f:\mygit\c\c_test\c_test\main.c(17): warning C4101: 'in' : unreferenced local variable
1>f:\mygit\c\c_test\c_test\main.c(16): warning C4101: 't' : unreferenced local variable
- 1>f:\mygit\c\c_test\c_test\main.c(51): warning C4013: 'malloc' undefined; assuming extern returning int
- KMP.c
- Generating Code...
- 1>f:\mygit\c\c_test\c_test\main.c(39): warning C4716: 'print_intarray' : must return a value
+ 1>f:\mygit\c\c_test\c_test\main.c(18): warning C4101: 'pos' : unreferenced local variable
+ 1>f:\mygit\c\c_test\c_test\main.c(52): warning C4013: 'malloc' undefined; assuming extern returning int
+ 1>f:\mygit\c\c_test\c_test\main.c(40): warning C4716: 'print_intarray' : must return a value
ManifestResourceCompile:
All outputs are up-to-date.
Link:
@@ -35,4 +33,4 @@
Build succeeded.
-Time Elapsed 00:00:02.83
+Time Elapsed 00:00:00.40
View
BIN  C_Test/C_Test/Debug/KMP.obj
Binary file not shown
View
BIN  C_Test/C_Test/Debug/Sorts.obj
Binary file not shown
View
BIN  C_Test/C_Test/Debug/TopN.obj
Binary file not shown
View
BIN  C_Test/C_Test/Debug/cl.command.1.tlog
Binary file not shown
View
1  C_Test/C_Test/Debug/link.4072-cvtres.read.1.tlog
@@ -0,0 +1 @@
+��
View
1  C_Test/C_Test/Debug/link.4072-cvtres.write.1.tlog
@@ -0,0 +1 @@
+��
View
1  C_Test/C_Test/Debug/link.4072.read.1.tlog
@@ -0,0 +1 @@
+��
View
1  C_Test/C_Test/Debug/link.4072.write.1.tlog
@@ -0,0 +1 @@
+��
View
BIN  C_Test/C_Test/Debug/link.read.1.tlog
Binary file not shown
View
BIN  C_Test/C_Test/Debug/main.obj
Binary file not shown
View
BIN  C_Test/C_Test/Debug/vc100.idb
Binary file not shown
View
BIN  C_Test/C_Test/Debug/vc100.pdb
Binary file not shown
View
33 C_Test/C_Test/Sorts.c
@@ -60,4 +60,35 @@ void build_max_heapify(int *a,int num)
}
}
-//quick sort
+//quick sort
+
+void quickSort(int *a,int i,int j)
+{
+
+ int left=i,right=j;
+ int pivot=a[left];
+ if(i>j)
+ return;
+ while(left!=right)
+ {
+ while(left<right&&a[right]>pivot)
+ {
+ right--;
+ }
+ if(left<right)
+ {
+ a[left++]=a[right];
+ }
+ while(left<right&&a[left]<=pivot)
+ {
+ left++;
+ }
+ if(left<right)
+ {
+ a[right--]=a[left];
+ }
+ }
+ a[left]=pivot;
+ quickSort(a,i,left-1);
+ quickSort(a,left+1,j);
+}
View
3  C_Test/C_Test/Sorts.h
@@ -1,3 +1,4 @@
extern int* BubbleSort(int* a,int len);
extern void max_heapify(int *a,int i,int len);
-extern void build_max_heapify(int *a,int num);
+extern void build_max_heapify(int *a,int num);
+extern void quickSort(int *a,int i,int j);
View
9 C_Test/C_Test/main.c
@@ -12,7 +12,7 @@ int main()
{
char *a="this is a string";
char *pattern="str";
- int i[10]={23,22,33,11,44,54,23,21,43,43};
+ int i[10]={9,4,6,8,2,7,3,1,5,0};
char *t,*p;
int *in;
int pos;
@@ -23,9 +23,10 @@ int main()
//t=word_reverse(t);
//in=BubbleSort(i,10);
//build_max_heapify(i,10);
- //print_intarray(i,10);
- pos=normal_match(a,pattern);
- printf("%d",pos);
+ quickSort(i,0,9);
+ print_intarray(i,10);
+ //pos=normal_match(a,pattern);
+ //printf("%d",pos);
getche();
}
View
BIN  C_Test/Debug/C_Test.exe
Binary file not shown
View
BIN  C_Test/Debug/C_Test.ilk
Binary file not shown
View
BIN  C_Test/Debug/C_Test.pdb
Binary file not shown
View
BIN  C_Test/ipch/c_test-ea06f819/c_test-f94310e.ipch
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.