1、简单实现二分法
#include <stdio.h>
int bin_search(int arr[], int size, int key)
{
int high = size - 1, low = 0;
while(low <= high)
{
/* 如果int溢出这种方式更安全一点 */
//int mid = (low + high) / 2;
1、简单实现二分法
#include <stdio.h>
int bin_search(int arr[], int size, int key)
{
int high = size - 1, low = 0;
while(low <= high)
{
/* 如果int溢出这种方式更安全一点 */
//int mid = (low + high) / 2;