当前位置:网站首页>Binarysearch basic binary search
Binarysearch basic binary search
2022-07-25 19:35:00 【_ Doris___】



ac Implementation code :
Position BinarySearch( List L, ElementType X )
{
int left=1,right=L->Last,mid=(left+right)/2;
while(left<=right)
{
if(L->Data[mid]>X)
{
right=mid-1;
}
else if(L->Data[mid]<X)
{
left=mid+1;
}
else if(L->Data[mid]==X)
{
return mid;
}
mid=(left+right)/2;
}
return NotFound;
}details :
left<=right Cannot be less than , Otherwise, even number , After finding it in the middle , Unable to enter the loop , Leakage .
边栏推荐
- 加州大学|用于未指定环境的可行对抗鲁棒强化学习
- Common misunderstandings caused by a time reporting assistant of Blue Bridge Cup basic questions
- [reading notes] deep learning Chapter 1: Introduction
- IP地址的概念
- Old wine in new bottles -- sample analysis of recent apt32 (sea Lotus) organizational attacks
- 解决Win10账户没有了管理员权限
- Siemens PLM Teamcenter download, installation and use tutorial
- An idea of solving div adapting to screen
- Oracle数据库下载、安装、使用教程及问题汇总
- Wxss template style and WXS scripting language for wechat applet development
猜你喜欢

基于PHP的中非南南合作信息交流平台网站建设

IP地址的概念

哈希无向图可视化

Security foundation 6 - vulnerability recurrence

微信小程序 26 播放音乐页的完善②

Wechat campus maintenance and repair application applet graduation design finished product of applet completion work (6) opening defense ppt

安全基础4 ---正则表达式

C# 合并集合

Wechat campus maintenance and repair applet graduation design finished product (7) Interim inspection report

前夕 - 0day威胁情报
随机推荐
[reading notes] deep learning Chapter 1: Introduction
Amrita Institute of Engineering | reinforcement active learning method for optimizing sampling in terms extraction of emotional analysis
[record of question brushing] 21. Merge two ordered linked lists
University of California | feasible confrontation robust reinforcement learning for unspecified environments
加州大学|用于未指定环境的可行对抗鲁棒强化学习
Oracle database download, installation, use tutorial and problem summary
Illegal mix of collations for operation ‘UNION‘(bug记录)
平衡二叉树
【好书推荐】-- 《以太网权威指南》(第2版)
919. Complete binary tree inserter
授权无线通信标准
虹科分享|如何解决勒索软件安全漏洞
微信小程序10-微搭模板
Improvement of wechat applet 26 playing music page ②
【HDLBits 刷题】Verilog Language(3)Modules: Hierarchy 部分
二叉树可视化
给容器添加3d效果的副标题
919. 完全二叉树插入器
Website construction of information exchange platform for China Africa South South cooperation based on PHP
C# 合并集合