折半查找法
来源:互联网 发布:淘宝上cf抽英雄武器 编辑:程序博客网 时间:2024/06/12 18:09
#include <stdio.h>
#include <stdlib.h>
int search(int a[],int l,int r,int g)
{
while(l<=r)
{
int m=(l+r)/2;
if(a[m]==g)return m;
if(a[m]>g)r=m-1;
else l=m+1;
}
return -1;
}
main()
{
int a[50];
for(int x=0;x<50;x++)a[x]=x;
printf("%d",search(a,10,40,25));
system("PAUSE");
}
- 折半查找法(递归)
- 折半查找法
- 汇编折半查找法
- 折半查找法
- 折半查找法
- 折半法查找
- 折半查找法
- 折半查找法
- 折半查找法C++
- 折半查找法
- JAVA折半查找法
- 折半查找法
- NSArray 折半查找法
- 折半查找法
- 折半查找法
- 折半查找法
- 折半查找法
- 算法:折半查找法
- VLAN虚拟局域网 从入门到精通
- Introduction to 3rdParty and Tools
- IDA Plugin - Desquirr decompiler
- 数组会越界,但是指针不会……
- 折半查找法(递归)
- 折半查找法
- Domino(IBM出品)
- 求最大公约数与最小公倍数
- SqlServer2000中nvarchar和varchar的区别?【新手教程】
- window.open()--窗口参数详解
- 查找表
- 烦人的无线-教训!
- Spring + Hibernate是如何管理数据库连接的
- 华为西安,中兴西安——近况