Permalink
Browse files

quick sort

  • Loading branch information...
1 parent ba87285 commit edf693bc879885a319f9cfa6d137e340d6d85f97 Fan Yu committed Jun 13, 2012
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
@@ -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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
+��
@@ -0,0 +1 @@
+��
@@ -0,0 +1 @@
+��
@@ -0,0 +1 @@
+��
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -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
@@ -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
@@ -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
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.

0 comments on commit edf693b

Please sign in to comment.