Skip to content

Commit

Permalink
10131508
Browse files Browse the repository at this point in the history
  • Loading branch information
mason51 committed Oct 13, 2012
1 parent 411e3ca commit 8db6c04
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
@@ -1 +1,9 @@
��¼һЩͨ�õĺ������������ 记录一些通用的函数,方便查找


minPrintf.cpp
记录了变长参数的知识点


binarySearch.cpp
二分查找
27 changes: 27 additions & 0 deletions binarySearch.cpp
@@ -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;
}
4 changes: 4 additions & 0 deletions minPrintf.cpp
@@ -1,4 +1,8 @@


/*
*¼ÇÔر䳤²ÎÊýÈçºÎʹÓÃ
*/



#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
Expand Down

0 comments on commit 8db6c04

Please sign in to comment.