Permalink
Browse files

10131508

  • Loading branch information...
1 parent 411e3ca commit 8db6c04c1af86bc78358cf9450ef7254441da4f8 @Yemsheng committed Oct 13, 2012
Showing with 40 additions and 1 deletion.
  1. +9 −1 README.md
  2. +27 −0 binarySearch.cpp
  3. +4 −0 minPrintf.cpp
View
@@ -1 +1,9 @@
-��¼һЩͨ�õĺ������������
+记录一些通用的函数,方便查找
+
+
+minPrintf.cpp
+记录了变长参数的知识点
+
+
+binarySearch.cpp
+二分查找
View
@@ -0,0 +1,27 @@
+
+
+int binarySearch(int value, int array[], int arraySize)
+{
+ int low = 0;
+ int high = arraySize - 1;
+ int mid = 0;
+
+ while(low <= high)
+ {
+ mid = (low + high) / 2;
+ if(value < array[mid])
+ {
+ high = mid - 1;
+ }
+ else if(value > array[mid])
+ {
+ low = mid + 1;
+ }
+ else
+ {
+ return mid;
+ }
+ }
+
+ return -1;
+}
View
@@ -1,4 +1,8 @@
+/*
+*¼ÇÔر䳤²ÎÊýÈçºÎʹÓÃ
+*/
+
#include <stdarg.h>
#include <stdio.h>

0 comments on commit 8db6c04

Please sign in to comment.