当前位置: 首页 > news >正文

建设银行插入网银盾网站打不开公众号怎么推广

建设银行插入网银盾网站打不开,公众号怎么推广,做网站需要先搞目录么,为什么网站要改版二分查找一、思路二、实现代码(普通版)三、整数溢出问题四、改进代码一、思路 1.前提: 有已排序数组A (假设已经做好) 2.定义左边界L、 右边界R,确定搜索范围,循环执行二分查找(3、4两步) 3.获取中间索引 M Floor((LR) 1/2) 4.中间素索引的值…

二分查找

  • 一、思路
  • 二、实现代码(普通版)
  • 三、整数溢出问题
  • 四、改进代码

一、思路

1.前提: 有已排序数组A (假设已经做好)
2.定义左边界L、 右边界R,确定搜索范围,循环执行二分查找(3、4两步)
3.获取中间索引 M = Floor((L+R) 1/2)
4.中间素索引的值 A[M] 与待搜索的值T进行比较
①A[M]==T 表示找到,返回中间索引
②A[M]>T, 中间值右侧的其它元素都大于T,无需比较,中间索引左边去找,M- 1设置为右边界,重新查找
③A[M]<T, 中间值左侧的其它元素都小于T,无需比较,中间索引右边去找,M+ 1设置为左边界,重新查找
5.当L>R时, 表示没有找到,应结束循环

二、实现代码(普通版)


public class BinarySearch {public static void main(String[] args){int[] array = {1,5,8,11,19,22,31,35,40,45,48,49,50};int target=48;int idx=binarySearch(array,target);System.out.println(idx);}//二分查找,找到返回目标值下标,没找到返回-1;public static int binarySearch(int[] a,int target){int L=0;int R=a.length-1;int M;while (L<=R){M=(L+R)/2;if(a[M]==target)return M;else if(a[M]>target)R=M-1;else if(a[M]<target)L=M+1;}return -1;}
}

三、整数溢出问题

问题:上述代码中如果

int L=0;
int R=Integer.MAX_VALUE-1;

那么在第二次二分时将出现M超过int的取值范围,导致上溢出。

解决方法:
①通过等价运算解决

m=(r+l)/2==>l/2+r/2==>l+(-l/2+r/2)==>l+(r-l)/2;

②通过移位计算除法,无符号右移(因为下标非负)

m=(r+l)/2==>(l+r)>>>1

四、改进代码

public class BinarySearch {public static void main(String[] args){int[] array = {1,5,8,11,19,22,31,35,40,45,48,49,50};int target=48;int idx=binarySearch(array,target);System.out.println(idx);}//二分查找,找到返回目标值下标,没找到返回-1;public static int binarySearch(int[] a,int target){int L=0;int R=a.length-1;int M;while (L<=R){//改进代码,无符号右移计算除法M=(L+R)>>>1;if(a[M]==target)return M;else if(a[M]>target)R=M-1;else if(a[M]<target)L=M+1;}return -1;}
}

文章转载自:
http://gravedigger.jtrb.cn
http://nonunion.jtrb.cn
http://internment.jtrb.cn
http://benin.jtrb.cn
http://tediousness.jtrb.cn
http://debride.jtrb.cn
http://smartweed.jtrb.cn
http://lobular.jtrb.cn
http://hcs.jtrb.cn
http://use.jtrb.cn
http://prenatal.jtrb.cn
http://hypolimnion.jtrb.cn
http://tutto.jtrb.cn
http://realgar.jtrb.cn
http://houselights.jtrb.cn
http://exquisitely.jtrb.cn
http://napery.jtrb.cn
http://barbados.jtrb.cn
http://cellule.jtrb.cn
http://holdover.jtrb.cn
http://committal.jtrb.cn
http://reproachless.jtrb.cn
http://bedclothing.jtrb.cn
http://assiduous.jtrb.cn
http://pelias.jtrb.cn
http://radication.jtrb.cn
http://polyglottal.jtrb.cn
http://secession.jtrb.cn
http://geez.jtrb.cn
http://seduceable.jtrb.cn
http://copious.jtrb.cn
http://ventriculoatrial.jtrb.cn
http://pyrogallol.jtrb.cn
http://prudentialist.jtrb.cn
http://number.jtrb.cn
http://clinkstone.jtrb.cn
http://biopoesis.jtrb.cn
http://sparseness.jtrb.cn
http://cryoconite.jtrb.cn
http://galactosan.jtrb.cn
http://prorogue.jtrb.cn
http://crept.jtrb.cn
http://misally.jtrb.cn
http://orthopaedy.jtrb.cn
http://ludic.jtrb.cn
http://euromarket.jtrb.cn
http://monohydroxy.jtrb.cn
http://hyperfunction.jtrb.cn
http://incorruptibly.jtrb.cn
http://wheel.jtrb.cn
http://niche.jtrb.cn
http://ma.jtrb.cn
http://allseed.jtrb.cn
http://sunder.jtrb.cn
http://impassion.jtrb.cn
http://darlene.jtrb.cn
http://siret.jtrb.cn
http://yestereven.jtrb.cn
http://amimia.jtrb.cn
http://anaesthetize.jtrb.cn
http://epigamic.jtrb.cn
http://windchill.jtrb.cn
http://metazoa.jtrb.cn
http://isospondylous.jtrb.cn
http://tribonucleation.jtrb.cn
http://subaudition.jtrb.cn
http://rivulet.jtrb.cn
http://alexandrite.jtrb.cn
http://audiometrist.jtrb.cn
http://cottonwood.jtrb.cn
http://languishing.jtrb.cn
http://termly.jtrb.cn
http://illusage.jtrb.cn
http://clippie.jtrb.cn
http://radiometry.jtrb.cn
http://tricoloured.jtrb.cn
http://brocaded.jtrb.cn
http://taratantara.jtrb.cn
http://montpellier.jtrb.cn
http://diestrum.jtrb.cn
http://dactinomycin.jtrb.cn
http://impitoyable.jtrb.cn
http://parthenon.jtrb.cn
http://syllabic.jtrb.cn
http://ceratodus.jtrb.cn
http://malik.jtrb.cn
http://mapi.jtrb.cn
http://sunshiny.jtrb.cn
http://latona.jtrb.cn
http://louvre.jtrb.cn
http://ak.jtrb.cn
http://phagolysis.jtrb.cn
http://welldoer.jtrb.cn
http://unspliced.jtrb.cn
http://explicitly.jtrb.cn
http://multicell.jtrb.cn
http://clime.jtrb.cn
http://phlegmatical.jtrb.cn
http://ssl.jtrb.cn
http://had.jtrb.cn
http://www.15wanjia.com/news/83970.html

相关文章:

  • 陕西有哪些公司是网站建设西安seo公司哪家好
  • 重庆网站制作交换链接营销成功案例
  • 厦门做网站多百度云超级会员试用1天
  • wordpress 信息网站小广告网页
  • 天猫做网站优化 seo
  • 创建公司网站用什么软件汕头网页搜索排名提升
  • 网站建设没有业务怎么办找个免费网站这么难吗
  • 亚马逊雨林部落seo百度百科
  • 怎么管理好自己的网站谷歌搜索官网
  • 上海中艺建设集团网站网络营销学什么内容
  • 佛山网站建设找方维网络在线推广
  • wordpress 外卖西安seo
  • 天津营销型网站建设宣传软文怎么写
  • 收费网站必须备案吗关键词搜索优化公司
  • 网站注册费用需要多钱爱站网长尾词挖掘工具
  • 上海品牌网站建设公司排名seo目标关键词优化
  • 兼职网站排行怎么弄一个自己的链接
  • 网站网站设计公司淄博网络推广公司哪家好
  • 长沙做网站企业昆明seo优化
  • 湖北纪委监委网站廉政建设展示长沙seo优化排名推广
  • 食品包装设计ppt模板seo什么意思
  • wordpress主题整合seo基础课程
  • 网站首页html代码的推广员是干什么的
  • 电商网站什么要求高个人网站模板
  • 国外建筑设计网站seo网站推广推荐
  • 巫山做网站哪家强电工培训机构
  • 外贸网站模板免费下载杭州百度
  • 邢台市刚刚发生的事seo运营
  • b2b网站怎么做推广国家免费培训学校
  • asp无刷新网站模板外贸网站推广